Merge pull request #74513 from Mic92/ferm

nixos/ferm: port test to python
This commit is contained in:
Jörg Thalheim 2019-12-01 01:27:56 +00:00 committed by GitHub
commit eabf256408
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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")
'';
})