summary refs log tree commit diff
path: root/nixos/tests/flannel.nix
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2020-04-14 23:40:11 +0200
committerFlorian Klink <flokli@flokli.de>2020-04-14 23:56:42 +0200
commit28ef43824bfbfa2ca115d9d942991ff34720b54f (patch)
tree232a9de2bcd0649b00ec067f1a9a35ca8e14decd /nixos/tests/flannel.nix
parent3dbfa915ab5df1041424e0a8b279daa59996b6eb (diff)
downloadnixpkgs-28ef43824bfbfa2ca115d9d942991ff34720b54f.tar
nixpkgs-28ef43824bfbfa2ca115d9d942991ff34720b54f.tar.gz
nixpkgs-28ef43824bfbfa2ca115d9d942991ff34720b54f.tar.bz2
nixpkgs-28ef43824bfbfa2ca115d9d942991ff34720b54f.tar.lz
nixpkgs-28ef43824bfbfa2ca115d9d942991ff34720b54f.tar.xz
nixpkgs-28ef43824bfbfa2ca115d9d942991ff34720b54f.tar.zst
nixpkgs-28ef43824bfbfa2ca115d9d942991ff34720b54f.zip
nixosTests.flannel: port to python, unbreak
For reasons yet unknown, the vxlan backend doesn't work (at least inside
the qemu networking), so this is moved to the udp backend.

Note changing the backend apparently also changes the interface name,
it's now `flannel0`, not `flannel.1`

fixes #74941
Diffstat (limited to 'nixos/tests/flannel.nix')
-rw-r--r--nixos/tests/flannel.nix37
1 files changed, 19 insertions, 18 deletions
diff --git a/nixos/tests/flannel.nix b/nixos/tests/flannel.nix
index 9991c5eaa32..7615732c20c 100644
--- a/nixos/tests/flannel.nix
+++ b/nixos/tests/flannel.nix
@@ -1,20 +1,24 @@
-import ./make-test.nix ({ pkgs, ...} : {
+import ./make-test-python.nix ({ lib, ...} : {
   name = "flannel";
 
-  meta = with pkgs.stdenv.lib.maintainers; {
+  meta = with lib.maintainers; {
     maintainers = [ offline ];
   };
 
   nodes = let
-    flannelConfig = {
+    flannelConfig = { pkgs, ... } : {
       services.flannel = {
         enable = true;
+        backend = {
+          Type = "udp";
+          Port = 8285;
+        };
         network = "10.1.0.0/16";
         iface = "eth1";
         etcd.endpoints = ["http://etcd:2379"];
       };
 
-      networking.firewall.allowedUDPPorts = [ 8472 ];
+      networking.firewall.allowedUDPPorts = [ 8285 ];
     };
   in {
     etcd = { ... }: {
@@ -32,25 +36,22 @@ import ./make-test.nix ({ pkgs, ...} : {
       networking.firewall.allowedTCPPorts = [ 2379 ];
     };
 
-    node1 = { ... }: {
-      require = [flannelConfig];
-    };
-
-    node2 = { ... }: {
-      require = [flannelConfig];
-    };
+    node1 = flannelConfig;
+    node2 = flannelConfig;
   };
 
   testScript = ''
-    startAll;
+    start_all()
 
-    $node1->waitForUnit("flannel.service");
-    $node2->waitForUnit("flannel.service");
+    node1.wait_for_unit("flannel.service")
+    node2.wait_for_unit("flannel.service")
 
-    my $ip1 = $node1->succeed("ip -4 addr show flannel.1 | grep -oP '(?<=inet).*(?=/)'");
-    my $ip2 = $node2->succeed("ip -4 addr show flannel.1 | grep -oP '(?<=inet).*(?=/)'");
+    node1.wait_until_succeeds("ip l show dev flannel0")
+    ip1 = node1.succeed("ip -4 addr show flannel0 | grep -oP '(?<=inet).*(?=/)'")
+    node2.wait_until_succeeds("ip l show dev flannel0")
+    ip2 = node2.succeed("ip -4 addr show flannel0 | grep -oP '(?<=inet).*(?=/)'")
 
-    $node1->waitUntilSucceeds("ping -c 1 $ip2");
-    $node2->waitUntilSucceeds("ping -c 1 $ip1");
+    node1.wait_until_succeeds(f"ping -c 1 {ip2}")
+    node2.wait_until_succeeds(f"ping -c 1 {ip1}")
   '';
 })