tlaternet-webserver/nix/checks/open-homepage.nix

44 lines
902 B
Nix
Raw Permalink Normal View History

{
self,
nixosTest,
}:
nixosTest {
2023-04-17 20:52:28 +01:00
name = "open-homepage";
nodes = {
# Host with just the default configuration
defaults = {
imports = [self.nixosModules.default];
services.tlaternet-webserver.enable = true;
};
host = {
imports = [self.nixosModules.default];
services.tlaternet-webserver = {
enable = true;
listen = {
addr = "0.0.0.0";
port = 8080;
};
};
networking.firewall.allowedTCPPorts = [8080];
};
client = {};
};
testScript = ''
start_all()
# 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")
'';
}