nixpkgs/nixos/tests/echoip.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

29 lines
615 B
Nix
Raw Permalink Normal View History

2025-03-06 02:00:59 +01:00
{ lib, ... }:
2025-01-11 16:57:57 +01:00
2025-03-06 02:00:59 +01:00
{
name = "echoip";
meta.maintainers = with lib.maintainers; [ defelo ];
2025-01-11 16:57:57 +01:00
2025-03-06 02:00:59 +01:00
nodes.machine = {
services.echoip = {
enable = true;
virtualHost = "echoip.local";
2025-01-11 16:57:57 +01:00
};
2025-03-06 02:00:59 +01:00
networking.hosts = {
"127.0.0.1" = [ "echoip.local" ];
"::1" = [ "echoip.local" ];
};
};
testScript = ''
machine.wait_for_unit("echoip.service")
machine.wait_for_open_port(8080)
2025-01-11 16:57:57 +01:00
2025-03-06 02:00:59 +01:00
resp = machine.succeed("curl -4 http://echoip.local/ip")
assert resp.strip() == "127.0.0.1"
resp = machine.succeed("curl -6 http://echoip.local/ip")
assert resp.strip() == "::1"
'';
}