1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-24 06:31:02 +00:00

unifi: Add NixOS tests

This commit is contained in:
Zhaofeng Li 2021-12-17 15:55:13 -08:00
parent a4bcad541e
commit 8bbae8e558
3 changed files with 41 additions and 1 deletions

View file

@ -485,6 +485,7 @@ in
ucarp = handleTest ./ucarp.nix {};
udisks2 = handleTest ./udisks2.nix {};
unbound = handleTest ./unbound.nix {};
unifi = handleTest ./unifi.nix {};
unit-php = handleTest ./web-servers/unit-php.nix {};
upnp = handleTest ./upnp.nix {};
usbguard = handleTest ./usbguard.nix {};

35
nixos/tests/unifi.nix Normal file
View file

@ -0,0 +1,35 @@
# 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 = [ zhaofengli ];
};
nodes.server = {
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; {
unifiLTS = makeAppTest unifiLTS;
unifi5 = makeAppTest unifi5;
unifi6 = makeAppTest unifi6;
}

View file

@ -1,4 +1,4 @@
{ lib, stdenv, dpkg, fetchurl, zip }:
{ lib, stdenv, dpkg, fetchurl, zip, nixosTests }:
let
generic = { version, sha256, suffix ? "", ... } @ args:
@ -28,6 +28,10 @@ let
runHook postInstall
'';
passthru.tests = {
unifi = nixosTests.unifi;
};
meta = with lib; {
homepage = "http://www.ubnt.com/";
description = "Controller for Ubiquiti UniFi access points";