mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-11-14 15:36:47 +03:00
nixos/netbox: add nixos test
This commit is contained in:
parent
dbd49febb5
commit
313b1dc9d0
@ -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 {};
|
||||
|
30
nixos/tests/web-apps/netbox.nix
Normal file
30
nixos/tests/web-apps/netbox.nix
Normal file
@ -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…
Reference in New Issue
Block a user