about summary refs log tree commit diff
path: root/nixos/tests/unifi.nix
blob: 789b11b55985cfaeed279c1d47dbe27e7abf890f (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
# Test UniFi controller

{ system ? builtins.currentSystem
, config ? { allowUnfree = true; }
, pkgs ? import ../.. { inherit system config; }
}:

with import ../lib/testing-python.nix { inherit system pkgs; };
with pkgs.lib;

let
  makeAppTest = unifi: makeTest {
    name = "unifi-controller-${unifi.version}";
    meta = with pkgs.lib.maintainers; {
      maintainers = [ patryk27 zhaofengli ];
    };

    nodes.server = {
      nixpkgs.config = config;

      services.unifi = {
        enable = true;
        unifiPackage = unifi;
        openFirewall = false;
      };
    };

    testScript = ''
      server.wait_for_unit("unifi.service")
      server.wait_until_succeeds("curl -Lk https://localhost:8443 >&2", timeout=300)
    '';
  };
in with pkgs; {
  unifi7 = makeAppTest unifi7;
  unifi8 = makeAppTest unifi8;
}