checks: Add assertion that the module defaults work

This commit is contained in:
Tristan Daniël Maat 2022-10-14 12:06:33 +01:00
parent 6c29bc5db0
commit 3155d665ff
Signed by: tlater
GPG key ID: 49670FD774E43268

View file

@ -4,32 +4,38 @@
}:
nixosTest {
nodes = {
# Host with just the default configuration
defaults = {
imports = [self.nixosModules.default];
services.tlaternet-webserver.enable = true;
};
host = {
config,
lib,
pkgs,
...
}: {
imports = [self.nixosModules.default];
services.tlaternet-webserver = {
enable = true;
listen = {
addr = "0.0.0.0";
port = 8000;
port = 8080;
};
};
networking.firewall.allowedTCPPorts = [8000];
networking.firewall.allowedTCPPorts = [8080];
};
client = {pkgs, ...}: {};
client = {};
};
testScript = ''
start_all()
host.wait_for_unit("default.target")
client.succeed("curl --fail http://host:8000/ >&2")
# Assert that the defaults work
defaults.wait_for_unit("tlaternet-webserver.service")
defaults.succeed("curl --fail http://localhost:8000 >&2")
# Assert that we can listen on a public interface
host.wait_for_unit("tlaternet-webserver.service")
client.succeed("curl --fail http://host:8080 >&2")
'';
}