about summary refs log tree commit diff
path: root/nixpkgs/nixos/tests/airsonic.nix
blob: 59bd84877c61c6d7806b065d7bdc55f1d02995cb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import ./make-test-python.nix ({ pkgs, ... }: {
  name = "airsonic";
  meta = with pkgs.lib.maintainers; {
    maintainers = [ sumnerevans ];
  };

  machine =
    { pkgs, ... }:
    {
      services.airsonic = {
        enable = true;
        maxMemory = 800;
      };

      # Airsonic is a Java application, and unfortunately requires a significant
      # amount of memory.
      virtualisation.memorySize = 1024;
    };

  testScript = ''
    def airsonic_is_up(_) -> bool:
        return machine.succeed("curl --fail http://localhost:4040/login")


    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)
  '';
})