Add basic unit test that evlauates the module
This commit is contained in:
parent
d9a5f6b7c2
commit
c1e27b73b0
24
flake.nix
24
flake.nix
|
@ -39,6 +39,30 @@
|
|||
'';
|
||||
};
|
||||
};
|
||||
|
||||
checks.${system}.test-module = let
|
||||
test-lib = import "${nixpkgs}/nixos/lib/testing-python.nix" {
|
||||
inherit system;
|
||||
};
|
||||
in
|
||||
test-lib.makeTest {
|
||||
name = "inquisitor-test-module";
|
||||
nodes = {
|
||||
host = { ... }: {
|
||||
imports = [ self.nixosModules.default ];
|
||||
services.inquisitor.enable = true;
|
||||
};
|
||||
};
|
||||
testScript = ''
|
||||
start_all()
|
||||
host.wait_for_unit("multi-user.target")
|
||||
# Check that the setup script ran
|
||||
host.succeed("[ -e /var/lib/inquisitor ]")
|
||||
# Check that the service came up
|
||||
host.succeed("systemctl is-enabled inquisitor")
|
||||
host.succeed("systemctl is-active inquisitor")
|
||||
'';
|
||||
};
|
||||
};
|
||||
in (my-flake.outputs-for each systems) // {
|
||||
overlays.default = final: prev: {
|
||||
|
|
|
@ -31,7 +31,7 @@ in
|
|||
config =
|
||||
let
|
||||
# Get the inquisitor package from the flake.
|
||||
inquisitor = flake.packages.${pkgs.stdenv.hostPlatform.system}.default;
|
||||
inquisitor = flake.packages.${pkgs.stdenv.hostPlatform.system}.env;
|
||||
|
||||
# Define the inquisitor state directory.
|
||||
stateDir = "/var/lib/inquisitor";
|
||||
|
@ -80,7 +80,7 @@ in
|
|||
if [ -f ${stateDir}/scp-helper ]; then
|
||||
${pkgs.coreutils}/bin/rm ${stateDir}/scp-helper
|
||||
fi
|
||||
ln -s -t ${stateDir}/scp-helper ${scp-helper}/bin/scp-helper
|
||||
ln -s -t ${stateDir} ${scp-helper}/bin/scp-helper
|
||||
'';
|
||||
|
||||
# Create a run script for the service.
|
||||
|
|
Loading…
Reference in New Issue