3
0
Fork 0
forked from mirrors/nixpkgs

nixos/ferm: port test to python

related to #72828
This commit is contained in:
Jörg Thalheim 2019-11-28 16:48:58 +00:00
parent 6317f5b81c
commit 189a345e22
No known key found for this signature in database
GPG key ID: 003F2096411B5F92

View file

@ -1,5 +1,5 @@
import ./make-test.nix ({ pkgs, ...} : { import ./make-test-python.nix ({ pkgs, ...} : {
name = "ferm"; name = "ferm";
meta = with pkgs.stdenv.lib.maintainers; { meta = with pkgs.stdenv.lib.maintainers; {
maintainers = [ mic92 ]; maintainers = [ mic92 ];
@ -53,24 +53,22 @@ import ./make-test.nix ({ pkgs, ...} : {
testScript = testScript =
'' ''
startAll; start_all()
$client->waitForUnit("network-online.target"); client.wait_for_unit("network-online.target")
$server->waitForUnit("ferm.service"); server.wait_for_unit("ferm.service")
$server->waitForUnit("nginx.service"); server.wait_for_unit("nginx.service")
$server->waitUntilSucceeds("ss -ntl | grep -q 80"); server.wait_until_succeeds("ss -ntl | grep -q 80")
subtest "port 80 is allowed", sub { with subtest("port 80 is allowed"):
$client->succeed("curl --fail -g http://192.168.1.1:80/status"); client.succeed("curl --fail -g http://192.168.1.1:80/status")
$client->succeed("curl --fail -g http://[fd00::1]:80/status"); client.succeed("curl --fail -g http://[fd00::1]:80/status")
};
subtest "port 8080 is not allowed", sub { 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://192.168.1.1:8080/status")
$server->succeed("curl --fail -g http://[fd00::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://192.168.1.1:8080/status")
$client->fail("curl --fail -g http://[fd00::1]:8080/status"); client.fail("curl --fail -g http://[fd00::1]:8080/status")
};
''; '';
}) })