Skip to content

Commit 110b3af

Browse files
committed
nixos/tests/echoip: use runTest
1 parent 5b67dad commit 110b3af

File tree

2 files changed

+24
-25
lines changed

2 files changed

+24
-25
lines changed

nixos/tests/all-tests.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ in {
341341
early-mount-options = handleTest ./early-mount-options.nix {};
342342
ec2-config = (handleTestOn ["x86_64-linux"] ./ec2.nix {}).boot-ec2-config or {};
343343
ec2-nixops = (handleTestOn ["x86_64-linux"] ./ec2.nix {}).boot-ec2-nixops or {};
344-
echoip = handleTest ./echoip.nix {};
344+
echoip = runTest ./echoip.nix;
345345
ecryptfs = handleTest ./ecryptfs.nix {};
346346
fscrypt = handleTest ./fscrypt.nix {};
347347
fastnetmon-advanced = runTest ./fastnetmon-advanced.nix;

nixos/tests/echoip.nix

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,28 @@
1-
import ./make-test-python.nix (
2-
{ lib, ... }:
3-
{
4-
name = "echoip";
5-
meta.maintainers = with lib.maintainers; [ defelo ];
1+
{ lib, ... }:
62

7-
nodes.machine = {
8-
services.echoip = {
9-
enable = true;
10-
virtualHost = "echoip.local";
11-
};
3+
{
4+
name = "echoip";
5+
meta.maintainers = with lib.maintainers; [ defelo ];
126

13-
networking.hosts = {
14-
"127.0.0.1" = [ "echoip.local" ];
15-
"::1" = [ "echoip.local" ];
16-
};
7+
nodes.machine = {
8+
services.echoip = {
9+
enable = true;
10+
virtualHost = "echoip.local";
1711
};
1812

19-
testScript = ''
20-
machine.wait_for_unit("echoip.service")
21-
machine.wait_for_open_port(8080)
13+
networking.hosts = {
14+
"127.0.0.1" = [ "echoip.local" ];
15+
"::1" = [ "echoip.local" ];
16+
};
17+
};
18+
19+
testScript = ''
20+
machine.wait_for_unit("echoip.service")
21+
machine.wait_for_open_port(8080)
2222
23-
resp = machine.succeed("curl -4 http://echoip.local/ip")
24-
assert resp.strip() == "127.0.0.1"
25-
resp = machine.succeed("curl -6 http://echoip.local/ip")
26-
assert resp.strip() == "::1"
27-
'';
28-
}
29-
)
23+
resp = machine.succeed("curl -4 http://echoip.local/ip")
24+
assert resp.strip() == "127.0.0.1"
25+
resp = machine.succeed("curl -6 http://echoip.local/ip")
26+
assert resp.strip() == "::1"
27+
'';
28+
}

0 commit comments

Comments
 (0)