Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)

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

+19 -18
+19 -18
nixos/tests/flannel.nix
··· 1 - import ./make-test.nix ({ pkgs, ...} : { 2 name = "flannel"; 3 4 - meta = with pkgs.stdenv.lib.maintainers; { 5 maintainers = [ offline ]; 6 }; 7 8 nodes = let 9 - flannelConfig = { 10 services.flannel = { 11 enable = true; 12 network = "10.1.0.0/16"; 13 iface = "eth1"; 14 etcd.endpoints = ["http://etcd:2379"]; 15 }; 16 17 - networking.firewall.allowedUDPPorts = [ 8472 ]; 18 }; 19 in { 20 etcd = { ... }: { ··· 32 networking.firewall.allowedTCPPorts = [ 2379 ]; 33 }; 34 35 - node1 = { ... }: { 36 - require = [flannelConfig]; 37 - }; 38 - 39 - node2 = { ... }: { 40 - require = [flannelConfig]; 41 - }; 42 }; 43 44 testScript = '' 45 - startAll; 46 47 - $node1->waitForUnit("flannel.service"); 48 - $node2->waitForUnit("flannel.service"); 49 50 - my $ip1 = $node1->succeed("ip -4 addr show flannel.1 | grep -oP '(?<=inet).*(?=/)'"); 51 - my $ip2 = $node2->succeed("ip -4 addr show flannel.1 | grep -oP '(?<=inet).*(?=/)'"); 52 53 - $node1->waitUntilSucceeds("ping -c 1 $ip2"); 54 - $node2->waitUntilSucceeds("ping -c 1 $ip1"); 55 ''; 56 })
··· 1 + import ./make-test-python.nix ({ lib, ...} : { 2 name = "flannel"; 3 4 + meta = with lib.maintainers; { 5 maintainers = [ offline ]; 6 }; 7 8 nodes = let 9 + flannelConfig = { pkgs, ... } : { 10 services.flannel = { 11 enable = true; 12 + backend = { 13 + Type = "udp"; 14 + Port = 8285; 15 + }; 16 network = "10.1.0.0/16"; 17 iface = "eth1"; 18 etcd.endpoints = ["http://etcd:2379"]; 19 }; 20 21 + networking.firewall.allowedUDPPorts = [ 8285 ]; 22 }; 23 in { 24 etcd = { ... }: { ··· 36 networking.firewall.allowedTCPPorts = [ 2379 ]; 37 }; 38 39 + node1 = flannelConfig; 40 + node2 = flannelConfig; 41 }; 42 43 testScript = '' 44 + start_all() 45 46 + node1.wait_for_unit("flannel.service") 47 + node2.wait_for_unit("flannel.service") 48 49 + node1.wait_until_succeeds("ip l show dev flannel0") 50 + ip1 = node1.succeed("ip -4 addr show flannel0 | grep -oP '(?<=inet).*(?=/)'") 51 + node2.wait_until_succeeds("ip l show dev flannel0") 52 + ip2 = node2.succeed("ip -4 addr show flannel0 | grep -oP '(?<=inet).*(?=/)'") 53 54 + node1.wait_until_succeeds(f"ping -c 1 {ip2}") 55 + node2.wait_until_succeeds(f"ping -c 1 {ip1}") 56 ''; 57 })