summaryrefslogtreecommitdiffstats
path: root/nixos/tests/ferm.nix
diff options
context:
space:
mode:
authorJörg Thalheim <joerg@thalheim.io>2019-11-28 16:48:58 +0000
committerJörg Thalheim <joerg@thalheim.io>2019-11-28 16:50:51 +0000
commit189a345e223bcc521474a53437e39193024d7c1a (patch)
tree8e216960aef433cb34eb12b7706db5f0a560078e /nixos/tests/ferm.nix
parent6317f5b81cedb5396f95b522afa84bc5059c3c1e (diff)
nixos/ferm: port test to python
related to #72828
Diffstat (limited to 'nixos/tests/ferm.nix')
-rw-r--r--nixos/tests/ferm.nix30
1 files changed, 14 insertions, 16 deletions
diff --git a/nixos/tests/ferm.nix b/nixos/tests/ferm.nix
index edf9c8036aca..a73c9ce739cf 100644
--- a/nixos/tests/ferm.nix
+++ b/nixos/tests/ferm.nix
@@ -1,5 +1,5 @@
-import ./make-test.nix ({ pkgs, ...} : {
+import ./make-test-python.nix ({ pkgs, ...} : {
name = "ferm";
meta = with pkgs.stdenv.lib.maintainers; {
maintainers = [ mic92 ];
@@ -53,24 +53,22 @@ import ./make-test.nix ({ pkgs, ...} : {
testScript =
''
- startAll;
+ start_all()
- $client->waitForUnit("network-online.target");
- $server->waitForUnit("ferm.service");
- $server->waitForUnit("nginx.service");
- $server->waitUntilSucceeds("ss -ntl | grep -q 80");
+ client.wait_for_unit("network-online.target")
+ server.wait_for_unit("ferm.service")
+ server.wait_for_unit("nginx.service")
+ server.wait_until_succeeds("ss -ntl | grep -q 80")
- subtest "port 80 is allowed", sub {
- $client->succeed("curl --fail -g http://192.168.1.1:80/status");
- $client->succeed("curl --fail -g http://[fd00::1]:80/status");
- };
+ with subtest("port 80 is allowed"):
+ client.succeed("curl --fail -g http://192.168.1.1:80/status")
+ client.succeed("curl --fail -g http://[fd00::1]:80/status")
- subtest "port 8080 is not allowed", sub {
- $server->succeed("curl --fail -g http://192.168.1.1:8080/status");
- $server->succeed("curl --fail -g http://[fd00::1]:8080/status");
+ with subtest("port 8080 is not allowed"):
+ server.succeed("curl --fail -g http://192.168.1.1:8080/status")
+ server.succeed("curl --fail -g http://[fd00::1]:8080/status")
- $client->fail("curl --fail -g http://192.168.1.1:8080/status");
- $client->fail("curl --fail -g http://[fd00::1]:8080/status");
- };
+ client.fail("curl --fail -g http://192.168.1.1:8080/status")
+ client.fail("curl --fail -g http://[fd00::1]:8080/status")
'';
})