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