mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-15 10:12:58 +00:00
a3c5c5eec4
airsonic_is_up should return a bool, but machine.succeed returns a string causing testScriptWithTypes to fail. This is fixed by executing the cmd with machine.execute and checking the status code.
30 lines
639 B
Nix
30 lines
639 B
Nix
import ./make-test-python.nix ({ pkgs, ... }: {
|
|
name = "airsonic";
|
|
meta = with pkgs.lib.maintainers; {
|
|
maintainers = [ sumnerevans ];
|
|
};
|
|
|
|
nodes.machine =
|
|
{ pkgs, ... }:
|
|
{
|
|
services.airsonic = {
|
|
enable = true;
|
|
maxMemory = 800;
|
|
};
|
|
};
|
|
|
|
testScript = ''
|
|
def airsonic_is_up(_) -> bool:
|
|
status, _ = machine.execute("curl --fail http://localhost:4040/login")
|
|
return status == 0
|
|
|
|
|
|
machine.start()
|
|
machine.wait_for_unit("airsonic.service")
|
|
machine.wait_for_open_port(4040)
|
|
|
|
with machine.nested("Waiting for UI to work"):
|
|
retry(airsonic_is_up)
|
|
'';
|
|
})
|