summaryrefslogtreecommitdiffstats
path: root/nixos/tests/containers-restart_networking.nix
diff options
context:
space:
mode:
authorMartin Milata <martin@martinmilata.cz>2019-12-01 02:29:24 +0100
committerMartin Milata <martin@martinmilata.cz>2019-12-08 18:16:01 +0100
commit6fbb76cf7664aa12170ba77b17687c759a860506 (patch)
tree7cad6e6253d02bea27e8010c85920b07ee6c543a /nixos/tests/containers-restart_networking.nix
parentcf5ec7ac6e9741e1ee3e0b2aa428fad83becbd73 (diff)
nixosTests.containers*: port rest to python
Diffstat (limited to 'nixos/tests/containers-restart_networking.nix')
-rw-r--r--nixos/tests/containers-restart_networking.nix90
1 files changed, 46 insertions, 44 deletions
diff --git a/nixos/tests/containers-restart_networking.nix b/nixos/tests/containers-restart_networking.nix
index df15f5b2f455..b50dadd13e47 100644
--- a/nixos/tests/containers-restart_networking.nix
+++ b/nixos/tests/containers-restart_networking.nix
@@ -16,7 +16,7 @@ let
};
};
};
-in import ./make-test.nix ({ pkgs, ...} :
+in import ./make-test-python.nix ({ pkgs, ...} :
{
name = "containers-restart_networking";
meta = with pkgs.stdenv.lib.maintainers; {
@@ -64,50 +64,52 @@ in import ./make-test.nix ({ pkgs, ...} :
eth1_bridged = nodes.client_eth1.config.system.build.toplevel;
eth1_rstp = nodes.client_eth1_rstp.config.system.build.toplevel;
in ''
- $client->start();
-
- $client->waitForUnit("default.target");
-
- subtest "initial state", sub {
- $client->succeed("ping 192.168.1.122 -c 1 -n >&2");
- $client->succeed("nixos-container run webserver -- ping -c 1 -n 192.168.1.1 >&2");
-
- $client->fail("ip l show eth1 |grep \"master br0\" >&2");
- $client->fail("grep eth1 /run/br0.interfaces >&2");
- };
-
- subtest "interfaces without stp", sub {
- $client->succeed("${eth1_bridged}/bin/switch-to-configuration test >&2");
-
- $client->succeed("ping 192.168.1.122 -c 1 -n >&2");
- $client->succeed("nixos-container run webserver -- ping -c 1 -n 192.168.1.2 >&2");
-
- $client->succeed("ip l show eth1 |grep \"master br0\" >&2");
- $client->succeed("grep eth1 /run/br0.interfaces >&2");
- };
-
- # activating rstp needs another service, therefor the bridge will restart and the container will loose its connectivity
- #subtest "interfaces with rstp", sub {
- # $client->succeed("${eth1_rstp}/bin/switch-to-configuration test >&2");
- # $client->execute("ip -4 a >&2");
- # $client->execute("ip l >&2");
+ client.start()
+
+ client.wait_for_unit("default.target")
+
+ with subtest("Initial configuration connectivity check"):
+ client.succeed("ping 192.168.1.122 -c 1 -n >&2")
+ client.succeed("nixos-container run webserver -- ping -c 1 -n 192.168.1.1 >&2")
+
+ client.fail("ip l show eth1 |grep 'master br0' >&2")
+ client.fail("grep eth1 /run/br0.interfaces >&2")
+
+ with subtest("Bridged configuration without STP preserves connectivity"):
+ client.succeed(
+ "${eth1_bridged}/bin/switch-to-configuration test >&2"
+ )
+
+ client.succeed(
+ "ping 192.168.1.122 -c 1 -n >&2",
+ "nixos-container run webserver -- ping -c 1 -n 192.168.1.2 >&2",
+ "ip l show eth1 |grep 'master br0' >&2",
+ "grep eth1 /run/br0.interfaces >&2",
+ )
+
+ # activating rstp needs another service, therefore the bridge will restart and the container will lose its connectivity
+ # with subtest("Bridged configuration with STP"):
+ # client.succeed("${eth1_rstp}/bin/switch-to-configuration test >&2")
+ # client.execute("ip -4 a >&2")
+ # client.execute("ip l >&2")
#
- # $client->succeed("ping 192.168.1.122 -c 1 -n >&2");
- # $client->succeed("nixos-container run webserver -- ping -c 1 -n 192.168.1.2 >&2");
- #
- # $client->succeed("ip l show eth1 |grep \"master br0\" >&2");
- # $client->succeed("grep eth1 /run/br0.interfaces >&2");
- #};
-
- subtest "back to no interfaces and no stp", sub {
- $client->succeed("${originalSystem}/bin/switch-to-configuration test >&2");
-
- $client->succeed("ping 192.168.1.122 -c 1 -n >&2");
- $client->succeed("nixos-container run webserver -- ping -c 1 -n 192.168.1.1 >&2");
-
- $client->fail("ip l show eth1 |grep \"master br0\" >&2");
- $client->fail("grep eth1 /run/br0.interfaces >&2");
- };
+ # client.succeed(
+ # "ping 192.168.1.122 -c 1 -n >&2",
+ # "nixos-container run webserver -- ping -c 1 -n 192.168.1.2 >&2",
+ # "ip l show eth1 |grep 'master br0' >&2",
+ # "grep eth1 /run/br0.interfaces >&2",
+ # )
+
+ with subtest("Reverting to initial configuration preserves connectivity"):
+ client.succeed(
+ "${originalSystem}/bin/switch-to-configuration test >&2"
+ )
+
+ client.succeed("ping 192.168.1.122 -c 1 -n >&2")
+ client.succeed("nixos-container run webserver -- ping -c 1 -n 192.168.1.1 >&2")
+
+ client.fail("ip l show eth1 |grep 'master br0' >&2")
+ client.fail("grep eth1 /run/br0.interfaces >&2")
'';
})