about summary refs log tree commit diff
path: root/nixos/tests/yggdrasil.nix
diff options
context:
space:
mode:
authorGemini Lasswell <gazally@runbox.com>2019-11-14 09:18:50 -0800
committerGemini Lasswell <gazally@runbox.com>2019-11-14 09:50:38 -0800
commit45c1be7cae661e14803c754a80bd89477fbae9a8 (patch)
tree4c7d602fec3da906e8b21f4b92b2541ec0fd50ad /nixos/tests/yggdrasil.nix
parent4f2e7e899dd814c222f29ae1d757988b469a6241 (diff)
downloadnixlib-45c1be7cae661e14803c754a80bd89477fbae9a8.tar
nixlib-45c1be7cae661e14803c754a80bd89477fbae9a8.tar.gz
nixlib-45c1be7cae661e14803c754a80bd89477fbae9a8.tar.bz2
nixlib-45c1be7cae661e14803c754a80bd89477fbae9a8.tar.lz
nixlib-45c1be7cae661e14803c754a80bd89477fbae9a8.tar.xz
nixlib-45c1be7cae661e14803c754a80bd89477fbae9a8.tar.zst
nixlib-45c1be7cae661e14803c754a80bd89477fbae9a8.zip
nixosTests.yggdrasil: port to python
Diffstat (limited to 'nixos/tests/yggdrasil.nix')
-rw-r--r--nixos/tests/yggdrasil.nix40
1 files changed, 21 insertions, 19 deletions
diff --git a/nixos/tests/yggdrasil.nix b/nixos/tests/yggdrasil.nix
index ddff35cce3a1..bb211f3860e3 100644
--- a/nixos/tests/yggdrasil.nix
+++ b/nixos/tests/yggdrasil.nix
@@ -19,7 +19,7 @@ let
     SigningPrivateKey = "2a6c21550f3fca0331df50668ffab66b6dce8237bcd5728e571e8033b363e247de111da0ec781e45bf6c63ecb45a78c24d7d4655abfaeea83b26c36eb5c0fd5b";
   };
 
-in import ./make-test.nix ({ pkgs, ...} : {
+in import ./make-test-python.nix ({ pkgs, ...} : {
   name = "yggdrasil";
   meta = with pkgs.stdenv.lib.maintainers; {
     maintainers = [ gazally ];
@@ -91,33 +91,35 @@ in import ./make-test.nix ({ pkgs, ...} : {
 
   testScript =
     ''
+      import re
+
       # Give Alice a head start so she is ready when Bob calls.
-      $alice->start;
-      $alice->waitForUnit("yggdrasil.service");
+      alice.start()
+      alice.wait_for_unit("yggdrasil.service")
 
-      $bob->start;
-      $carol->start;
-      $bob->waitForUnit("yggdrasil.service");
-      $carol->waitForUnit("yggdrasil.service");
+      bob.start()
+      carol.start()
+      bob.wait_for_unit("yggdrasil.service")
+      carol.wait_for_unit("yggdrasil.service")
 
-      $carol->waitUntilSucceeds("[ `ip -o -6 addr show dev ygg0 scope global | grep -v tentative | wc -l` -ge 1 ]");
-      my $carolIp6 = (split /[ \/]+/, $carol->succeed("ip -o -6 addr show dev ygg0 scope global"))[3];
+      ip_addr_show = "ip -o -6 addr show dev ygg0 scope global"
+      carol.wait_until_succeeds(f"[ `{ip_addr_show} | grep -v tentative | wc -l` -ge 1 ]")
+      carol_ip6 = re.split(" +|/", carol.succeed(ip_addr_show))[3]
 
       # If Alice can talk to Carol, then Bob's outbound peering and Carol's
       # local peering have succeeded and everybody is connected.
-      $alice->waitUntilSucceeds("ping -c 1 $carolIp6");
-      $alice->succeed("ping -c 1 ${bobIp6}");
-
-      $bob->succeed("ping -c 1 ${aliceIp6}");
-      $bob->succeed("ping -c 1 $carolIp6");
+      alice.wait_until_succeeds(f"ping -c 1 {carol_ip6}")
+      alice.succeed(f"ping -c 1 ${bobIp6}")
 
-      $carol->succeed("ping -c 1 ${aliceIp6}");
-      $carol->succeed("ping -c 1 ${bobIp6}");
+      bob.succeed("ping -c 1 ${aliceIp6}")
+      bob.succeed(f"ping -c 1 {carol_ip6}")
 
-      $carol->fail("journalctl -u dhcpcd | grep ygg0");
+      carol.succeed("ping -c 1 ${aliceIp6}")
+      carol.succeed("ping -c 1 ${bobIp6}")
 
-      $alice->waitForUnit("httpd.service");
-      $carol->succeed("curl --fail -g http://[${aliceIp6}]");
+      carol.fail("journalctl -u dhcpcd | grep ygg0")
 
+      alice.wait_for_unit("httpd.service")
+      carol.succeed("curl --fail -g http://[${aliceIp6}]")
     '';
 })