git.iko.soy/typeable/nixpkgs
on master help sign in
nixosTests.quagga: Port tests to python
commite96802ccb22f110fe9e93783856b2aef10b14608 authorChristian Kampka <christian@kampka.net> dateSun 15 Dec 2019, 18:29 (7 years ago) parentbcf6aa5
1 file changed+14−14
nixos/tests/quagga.nix+14−14
nixos/tests/quagga.nix+14−14
@@ -5,7 +5,7 @@
55#
66# All interfaces are in OSPF Area 0.
77
8−import ./make-test.nix ({ pkgs, ... }:
8+import ./make-test-python.nix ({ pkgs, ... }:
99 let
1010
1111 ifAddr = node: iface: (pkgs.lib.head node.config.networking.interfaces.${iface}.ipv4.addresses).address;
@@ -74,23 +74,23 @@ import ./make-test.nix ({ pkgs, ... }:
7474 testScript =
7575 { ... }:
7676 ''
77− startAll;
77+ start_all()
7878
7979 # Wait for the networking to start on all machines
80− $_->waitForUnit("network.target") foreach values %vms;
80+ for machine in client, router1, router2, server:
81+ machine.wait_for_unit("network.target")
8182
82− # Wait for OSPF to form adjacencies
83− for my $gw ($router1, $router2) {
84− $gw->waitForUnit("ospfd");
85− $gw->waitUntilSucceeds("vtysh -c 'show ip ospf neighbor' | grep Full");
86− $gw->waitUntilSucceeds("vtysh -c 'show ip route' | grep '^O>'");
87− }
83+ with subtest("Wait for OSPF to form adjacencies"):
84+ for gw in router1, router2:
85+ gw.wait_for_unit("ospfd")
86+ gw.wait_until_succeeds("vtysh -c 'show ip ospf neighbor' | grep Full")
87+ gw.wait_until_succeeds("vtysh -c 'show ip route' | grep '^O>'")
8888
89− # Test ICMP.
90− $client->succeed("ping -c 3 server >&2");
89+ with subtest("Test ICMP"):
90+ client.wait_until_succeeds("ping -c 3 server >&2")
9191
92− # Test whether HTTP works.
93− $server->waitForUnit("httpd");
94− $client->succeed("curl --fail http://server/ >&2");
92+ with subtest("Test whether HTTP works"):
93+ server.wait_for_unit("httpd")
94+ client.succeed("curl --fail http://server/ >&2")
9595 '';
9696 })