tests: add working test for website
This commit is contained in:
parent
99308bfe24
commit
f087e088c6
11
flake.nix
11
flake.nix
|
@ -65,6 +65,7 @@
|
|||
system,
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
{
|
||||
|
@ -77,6 +78,16 @@
|
|||
unstable = import inputs.unstable { inherit system; };
|
||||
master = import inputs.master { inherit system; };
|
||||
};
|
||||
|
||||
packages = let
|
||||
nixos-lib = import (inputs.nixpkgs + "/nixos/lib") { };
|
||||
in builtins.listToAttrs (
|
||||
map (x: {
|
||||
name = "test-${lib.strings.removeSuffix ".nix" x}";
|
||||
value = nixos-lib.runTest (import (./tests + "/${x}") { inherit self; inherit pkgs; inherit lib; inherit config; });
|
||||
}) (builtins.attrNames (builtins.readDir ./tests))
|
||||
);
|
||||
|
||||
devShells.default = pkgs.mkShell {
|
||||
buildInputs = with pkgs; [
|
||||
deploy-rs
|
||||
|
|
|
@ -6,7 +6,9 @@
|
|||
...
|
||||
}:
|
||||
{
|
||||
nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ ];
|
||||
nixpkgs.config = lib.mkDefault {
|
||||
allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ ];
|
||||
};
|
||||
|
||||
nix = {
|
||||
# Use default version alias for nix package
|
||||
|
|
|
@ -8,17 +8,26 @@
|
|||
{
|
||||
name = "website";
|
||||
|
||||
nodes.nachtigall-test = self.nixosConfigurations.nachtigall-test;
|
||||
|
||||
node.specialArgs = self.outputs.nixosConfigurations.nachtigall._module.specialArgs;
|
||||
hostPkgs = pkgs;
|
||||
|
||||
node.pkgs = pkgs;
|
||||
node.specialArgs = self.outputs.nixosConfigurations.nachtigall._module.specialArgs;
|
||||
|
||||
nodes.nachtigall-test = {
|
||||
imports = [
|
||||
self.nixosModules.home-manager
|
||||
self.nixosModules.core
|
||||
self.nixosModules.nginx
|
||||
self.nixosModules.nginx-website
|
||||
];
|
||||
};
|
||||
|
||||
enableOCR = true;
|
||||
|
||||
testScript = ''
|
||||
machine.wait_for_unit("system.slice")
|
||||
machine.succeed("ping 127.0.0.1 -c 2")
|
||||
machine.wait_for_unit("nginx.service")
|
||||
machine.succeed("curl -H 'Host:pub.solar' http://127.0.0.1/")
|
||||
nachtigall_test.wait_for_unit("system.slice")
|
||||
nachtigall_test.succeed("ping 127.0.0.1 -c 2")
|
||||
nachtigall_test.wait_for_unit("nginx.service")
|
||||
nachtigall_test.succeed("curl -H 'Host:pub.solar' http://127.0.0.1/")
|
||||
'';
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue