about summary refs log tree commit diff
path: root/nixos/tests/mediatomb.nix
blob: 9c84aa3e92a5d264465b79cd0a58e1a7922f683b (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
33
34
35
36
37
38
39
40
41
42
43
44
import ./make-test-python.nix {
  name = "mediatomb";

  nodes = {
    server = {
      services.mediatomb = {
        enable = true;
        serverName = "Gerbera";
        interface = "eth1";
        openFirewall = true;
        mediaDirectories = [
          {
            path = "/var/lib/gerbera/pictures";
            recursive = false;
            hidden-files = false;
          }
          {
            path = "/var/lib/gerbera/audio";
            recursive = true;
            hidden-files = false;
          }
        ];
      };
      systemd.tmpfiles.rules = [
        "d /var/lib/gerbera/pictures 0770 mediatomb mediatomb"
        "d /var/lib/gerbera/audio 0770 mediatomb mediatomb"
      ];
    };

    client = {};
  };

  testScript = ''
    start_all()

    server.wait_for_unit("mediatomb")
    server.wait_until_succeeds("nc -z 192.168.1.2 49152")
    server.succeed("curl -v --fail http://server:49152/")

    client.wait_for_unit("multi-user.target")
    page = client.succeed("curl -v --fail http://server:49152/")
    assert "Gerbera" in page and "MediaTomb" not in page
  '';
}