summary refs log tree commit diff
path: root/nixos/tests
diff options
context:
space:
mode:
authorChristian Kampka <christian@kampka.net>2019-12-15 18:29:20 +0100
committerChristian Kampka <christian@kampka.net>2019-12-15 20:07:52 +0100
commite96802ccb22f110fe9e93783856b2aef10b14608 (patch)
treed1786a509e3ea7641d035280dc90ad125b427d0e /nixos/tests
parentbcf6aa5519c041301042abf38aeff6127b7c4567 (diff)
downloadnixpkgs-e96802ccb22f110fe9e93783856b2aef10b14608.tar
nixpkgs-e96802ccb22f110fe9e93783856b2aef10b14608.tar.gz
nixpkgs-e96802ccb22f110fe9e93783856b2aef10b14608.tar.bz2
nixpkgs-e96802ccb22f110fe9e93783856b2aef10b14608.tar.lz
nixpkgs-e96802ccb22f110fe9e93783856b2aef10b14608.tar.xz
nixpkgs-e96802ccb22f110fe9e93783856b2aef10b14608.tar.zst
nixpkgs-e96802ccb22f110fe9e93783856b2aef10b14608.zip
nixosTests.quagga: Port tests to python
Diffstat (limited to 'nixos/tests')
-rw-r--r--nixos/tests/quagga.nix28
1 files changed, 14 insertions, 14 deletions
diff --git a/nixos/tests/quagga.nix b/nixos/tests/quagga.nix
index 6aee7ea57f0..04590aa0eb3 100644
--- a/nixos/tests/quagga.nix
+++ b/nixos/tests/quagga.nix
@@ -5,7 +5,7 @@
 #
 # All interfaces are in OSPF Area 0.
 
-import ./make-test.nix ({ pkgs, ... }:
+import ./make-test-python.nix ({ pkgs, ... }:
   let
 
     ifAddr = node: iface: (pkgs.lib.head node.config.networking.interfaces.${iface}.ipv4.addresses).address;
@@ -74,23 +74,23 @@ import ./make-test.nix ({ pkgs, ... }:
       testScript =
         { ... }:
         ''
-          startAll;
+          start_all()
 
           # Wait for the networking to start on all machines
-          $_->waitForUnit("network.target") foreach values %vms;
+          for machine in client, router1, router2, server:
+              machine.wait_for_unit("network.target")
 
-          # Wait for OSPF to form adjacencies
-          for my $gw ($router1, $router2) {
-              $gw->waitForUnit("ospfd");
-              $gw->waitUntilSucceeds("vtysh -c 'show ip ospf neighbor' | grep Full");
-              $gw->waitUntilSucceeds("vtysh -c 'show ip route' | grep '^O>'");
-          }
+          with subtest("Wait for OSPF to form adjacencies"):
+              for gw in router1, router2:
+                  gw.wait_for_unit("ospfd")
+                  gw.wait_until_succeeds("vtysh -c 'show ip ospf neighbor' | grep Full")
+                  gw.wait_until_succeeds("vtysh -c 'show ip route' | grep '^O>'")
 
-          # Test ICMP.
-          $client->succeed("ping -c 3 server >&2");
+          with subtest("Test ICMP"):
+              client.wait_until_succeeds("ping -c 3 server >&2")
 
-          # Test whether HTTP works.
-          $server->waitForUnit("httpd");
-          $client->succeed("curl --fail http://server/ >&2");
+          with subtest("Test whether HTTP works"):
+              server.wait_for_unit("httpd")
+              client.succeed("curl --fail http://server/ >&2")
         '';
     })