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