summary refs log tree commit diff
path: root/nixos/tests/networking.nix
diff options
context:
space:
mode:
authorVladimír Čunát <v@cunat.cz>2020-03-13 21:47:07 +0100
committerVladimír Čunát <v@cunat.cz>2020-03-13 22:05:33 +0100
commit0729b8c55e0dfaf302af4c57546871d47a652048 (patch)
tree9f0e22627003b9c258884e37951a1163d714662f /nixos/tests/networking.nix
parent506be57540a245b575ad72623769d36b398cdde2 (diff)
downloadnixpkgs-0729b8c55e0dfaf302af4c57546871d47a652048.tar
nixpkgs-0729b8c55e0dfaf302af4c57546871d47a652048.tar.gz
nixpkgs-0729b8c55e0dfaf302af4c57546871d47a652048.tar.bz2
nixpkgs-0729b8c55e0dfaf302af4c57546871d47a652048.tar.lz
nixpkgs-0729b8c55e0dfaf302af4c57546871d47a652048.tar.xz
nixpkgs-0729b8c55e0dfaf302af4c57546871d47a652048.tar.zst
nixpkgs-0729b8c55e0dfaf302af4c57546871d47a652048.zip
Revert Merge #82310: nixos/systemd: apply .link
...even when networkd is disabled

This reverts commit ce78f3ac701017008aa7f1db387b871b7ae65e01, reversing
changes made to dc34da0755b3c36469965659c0ee4a1337e81c05.

I'm sorry; Hydra has been unable to evaluate, always returning
> error: unexpected EOF reading a line
and I've been unable to reproduce the problem locally.  Bisecting
pointed to this merge, but I still can't see what exactly was wrong.
Diffstat (limited to 'nixos/tests/networking.nix')
-rw-r--r--nixos/tests/networking.nix60
1 files changed, 18 insertions, 42 deletions
diff --git a/nixos/tests/networking.nix b/nixos/tests/networking.nix
index a519ca06594..933a4451af9 100644
--- a/nixos/tests/networking.nix
+++ b/nixos/tests/networking.nix
@@ -5,10 +5,11 @@
 , networkd }:
 
 with import ../lib/testing-python.nix { inherit system pkgs; };
+with pkgs.lib;
 
 let
-  router = { config, pkgs, lib, ... }:
-    with lib;
+  router = { config, pkgs, ... }:
+    with pkgs.lib;
     let
       vlanIfs = range 1 (length config.virtualisation.vlans);
     in {
@@ -84,7 +85,7 @@ let
     static = {
       name = "Static";
       nodes.router = router;
-      nodes.client = { pkgs, lib, ... }: with lib; {
+      nodes.client = { pkgs, ... }: with pkgs.lib; {
         virtualisation.vlans = [ 1 2 ];
         networking = {
           useNetworkd = networkd;
@@ -136,7 +137,7 @@ let
     dhcpSimple = {
       name = "SimpleDHCP";
       nodes.router = router;
-      nodes.client = { pkgs, lib, ... }: with lib; {
+      nodes.client = { pkgs, ... }: with pkgs.lib; {
         virtualisation.vlans = [ 1 2 ];
         networking = {
           useNetworkd = networkd;
@@ -192,7 +193,7 @@ let
     dhcpOneIf = {
       name = "OneInterfaceDHCP";
       nodes.router = router;
-      nodes.client = { pkgs, lib, ... }: with lib; {
+      nodes.client = { pkgs, ... }: with pkgs.lib; {
         virtualisation.vlans = [ 1 2 ];
         networking = {
           useNetworkd = networkd;
@@ -231,7 +232,7 @@ let
         '';
     };
     bond = let
-      node = address: { pkgs, lib, ... }: with lib; {
+      node = address: { pkgs, ... }: with pkgs.lib; {
         virtualisation.vlans = [ 1 2 ];
         networking = {
           useNetworkd = networkd;
@@ -267,7 +268,7 @@ let
         '';
     };
     bridge = let
-      node = { address, vlan }: { pkgs, lib, ... }: with lib; {
+      node = { address, vlan }: { pkgs, ... }: with pkgs.lib; {
         virtualisation.vlans = [ vlan ];
         networking = {
           useNetworkd = networkd;
@@ -280,7 +281,7 @@ let
       name = "Bridge";
       nodes.client1 = node { address = "192.168.1.2"; vlan = 1; };
       nodes.client2 = node { address = "192.168.1.3"; vlan = 2; };
-      nodes.router = { pkgs, lib, ... }: with lib; {
+      nodes.router = { pkgs, ... }: with pkgs.lib; {
         virtualisation.vlans = [ 1 2 ];
         networking = {
           useNetworkd = networkd;
@@ -317,7 +318,7 @@ let
     macvlan = {
       name = "MACVLAN";
       nodes.router = router;
-      nodes.client = { pkgs, lib, ... }: with lib; {
+      nodes.client = { pkgs, ... }: with pkgs.lib; {
         environment.systemPackages = [ pkgs.iptables ]; # to debug firewall rules
         virtualisation.vlans = [ 1 ];
         networking = {
@@ -371,7 +372,7 @@ let
         '';
     };
     sit = let
-      node = { address4, remote, address6 }: { pkgs, lib, ... }: with lib; {
+      node = { address4, remote, address6 }: { pkgs, ... }: with pkgs.lib; {
         virtualisation.vlans = [ 1 ];
         networking = {
           useNetworkd = networkd;
@@ -413,7 +414,7 @@ let
         '';
     };
     vlan = let
-      node = address: { pkgs, lib, ... }: with lib; {
+      node = address: { pkgs, ... }: with pkgs.lib; {
         #virtualisation.vlans = [ 1 ];
         networking = {
           useNetworkd = networkd;
@@ -526,7 +527,7 @@ let
           '';
         };
       };
-      nodes.client_with_privacy = { pkgs, lib, ... }: with lib; {
+      nodes.client_with_privacy = { pkgs, ... }: with pkgs.lib; {
         virtualisation.vlans = [ 1 ];
         networking = {
           useNetworkd = networkd;
@@ -539,7 +540,7 @@ let
           };
         };
       };
-      nodes.client = { pkgs, lib, ... }: with lib; {
+      nodes.client = { pkgs, ... }: with pkgs.lib; {
         virtualisation.vlans = [ 1 ];
         networking = {
           useNetworkd = networkd;
@@ -602,9 +603,9 @@ let
 
       testScript = ''
         targetIPv4Table = """
-        10.0.0.0/16 proto static scope link mtu 1500
-        192.168.1.0/24 proto kernel scope link src 192.168.1.2
-        192.168.2.0/24 via 192.168.1.1 proto static
+        10.0.0.0/16 proto static scope link mtu 1500 
+        192.168.1.0/24 proto kernel scope link src 192.168.1.2 
+        192.168.2.0/24 via 192.168.1.1 proto static 
         """.strip()
 
         targetIPv6Table = """
@@ -654,33 +655,8 @@ let
             ), "The IPv6 routing table has not been properly cleaned:\n{}".format(ipv6Residue)
       '';
     };
-    # even with disabled networkd, systemd.network.links should work
-    # (as it's handled by udev, not networkd)
-    link = {
-      name = "Link";
-      nodes.client = { pkgs, ... }: {
-        virtualisation.vlans = [ 1 ];
-        networking = {
-          useNetworkd = networkd;
-          useDHCP = false;
-        };
-        systemd.network.links."50-foo" = {
-          matchConfig = {
-            Name = "foo";
-            Driver = "dummy";
-          };
-          linkConfig.MTUBytes = "1442";
-        };
-      };
-      testScript = ''
-        print(client.succeed("ip l add name foo type dummy"))
-        print(client.succeed("stat /etc/systemd/network/50-foo.link"))
-        client.succeed("udevadm settle")
-        assert "mtu 1442" in client.succeed("ip l show dummy0")
-      '';
-    };
   };
 
-in pkgs.lib.mapAttrs (pkgs.lib.const (attrs: makeTest (attrs // {
+in mapAttrs (const (attrs: makeTest (attrs // {
   name = "${attrs.name}-Networking-${if networkd then "Networkd" else "Scripted"}";
 }))) testCases