tests: add working test for website
This commit is contained in:
parent
b6be95d032
commit
f96b31a8a9
11
flake.nix
11
flake.nix
|
@ -65,6 +65,7 @@
|
||||||
system,
|
system,
|
||||||
pkgs,
|
pkgs,
|
||||||
config,
|
config,
|
||||||
|
lib,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
{
|
{
|
||||||
|
@ -77,6 +78,16 @@
|
||||||
unstable = import inputs.unstable { inherit system; };
|
unstable = import inputs.unstable { inherit system; };
|
||||||
master = import inputs.master { 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 {
|
devShells.default = pkgs.mkShell {
|
||||||
buildInputs = with pkgs; [
|
buildInputs = with pkgs; [
|
||||||
deploy-rs
|
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 = {
|
nix = {
|
||||||
# Use default version alias for nix package
|
# Use default version alias for nix package
|
||||||
|
|
|
@ -8,17 +8,26 @@
|
||||||
{
|
{
|
||||||
name = "website";
|
name = "website";
|
||||||
|
|
||||||
nodes.nachtigall-test = self.nixosConfigurations.nachtigall-test;
|
|
||||||
|
|
||||||
node.specialArgs = self.outputs.nixosConfigurations.nachtigall._module.specialArgs;
|
|
||||||
hostPkgs = pkgs;
|
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;
|
enableOCR = true;
|
||||||
|
|
||||||
testScript = ''
|
testScript = ''
|
||||||
machine.wait_for_unit("system.slice")
|
nachtigall_test.wait_for_unit("system.slice")
|
||||||
machine.succeed("ping 127.0.0.1 -c 2")
|
nachtigall_test.succeed("ping 127.0.0.1 -c 2")
|
||||||
machine.wait_for_unit("nginx.service")
|
nachtigall_test.wait_for_unit("nginx.service")
|
||||||
machine.succeed("curl -H 'Host:pub.solar' http://127.0.0.1/")
|
nachtigall_test.succeed("curl -H 'Host:pub.solar' http://127.0.0.1/")
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue