nixos/netbox: add nixos test

main
Ember 'n0emis' Keske 2 years ago
parent dbd49febb5
commit 313b1dc9d0
No known key found for this signature in database
GPG Key ID: 00FAF748B777CF10
  1. 1
      nixos/tests/all-tests.nix
  2. 30
      nixos/tests/web-apps/netbox.nix
  3. 5
      pkgs/servers/web-apps/netbox/default.nix

@ -341,6 +341,7 @@ in
networking.networkd = handleTest ./networking.nix { networkd = true; };
networking.scripted = handleTest ./networking.nix { networkd = false; };
specialisation = handleTest ./specialisation.nix {};
netbox = handleTest ./web-apps/netbox.nix {};
# TODO: put in networking.nix after the test becomes more complete
networkingProxy = handleTest ./networking-proxy.nix {};
nextcloud = handleTest ./nextcloud {};

@ -0,0 +1,30 @@
import ../make-test-python.nix ({ lib, pkgs, ... }: {
name = "netbox";
meta = with lib.maintainers; {
maintainers = [ n0emis ];
};
machine = { ... }: {
services.netbox = {
enable = true;
secretKeyFile = pkgs.writeText "secret" ''
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
'';
};
};
testScript = ''
machine.start()
machine.wait_for_unit("netbox.target")
machine.wait_until_succeeds("journalctl --since -1m --unit netbox --grep Listening")
with subtest("Home screen loads"):
machine.succeed(
"curl -sSfL http://[::1]:8001 | grep '<title>Home | NetBox</title>'"
)
with subtest("Staticfiles are generated"):
machine.succeed("test -e /var/lib/netbox/static/netbox.js")
'';
})

@ -1,6 +1,7 @@
{ lib
, pkgs
, fetchFromGitHub
, nixosTests
, python3
, plugins ? ps: [] }:
@ -101,6 +102,10 @@ py.pkgs.buildPythonApplication rec {
passthru = {
# PYTHONPATH of all dependencies used by the package
pythonPath = python3.pkgs.makePythonPath propagatedBuildInputs;
tests = {
inherit (nixosTests) netbox;
};
};
meta = with lib; {

Loading…
Cancel
Save