nixosTests.quagga: Port tests to python

This commit is contained in:
Christian Kampka 2019-12-15 18:29:20 +01:00
parent bcf6aa5519
commit e96802ccb2
No known key found for this signature in database
GPG Key ID: B88E140DB4FE1AA5
1 changed files with 14 additions and 14 deletions

View File

@ -5,7 +5,7 @@
# #
# All interfaces are in OSPF Area 0. # All interfaces are in OSPF Area 0.
import ./make-test.nix ({ pkgs, ... }: import ./make-test-python.nix ({ pkgs, ... }:
let let
ifAddr = node: iface: (pkgs.lib.head node.config.networking.interfaces.${iface}.ipv4.addresses).address; ifAddr = node: iface: (pkgs.lib.head node.config.networking.interfaces.${iface}.ipv4.addresses).address;
@ -74,23 +74,23 @@ import ./make-test.nix ({ pkgs, ... }:
testScript = testScript =
{ ... }: { ... }:
'' ''
startAll; start_all()
# Wait for the networking to start on all machines # 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 with subtest("Wait for OSPF to form adjacencies"):
for my $gw ($router1, $router2) { for gw in router1, router2:
$gw->waitForUnit("ospfd"); gw.wait_for_unit("ospfd")
$gw->waitUntilSucceeds("vtysh -c 'show ip ospf neighbor' | grep Full"); gw.wait_until_succeeds("vtysh -c 'show ip ospf neighbor' | grep Full")
$gw->waitUntilSucceeds("vtysh -c 'show ip route' | grep '^O>'"); gw.wait_until_succeeds("vtysh -c 'show ip route' | grep '^O>'")
}
# Test ICMP. with subtest("Test ICMP"):
$client->succeed("ping -c 3 server >&2"); client.wait_until_succeeds("ping -c 3 server >&2")
# Test whether HTTP works. with subtest("Test whether HTTP works"):
$server->waitForUnit("httpd"); server.wait_for_unit("httpd")
$client->succeed("curl --fail http://server/ >&2"); client.succeed("curl --fail http://server/ >&2")
''; '';
}) })