summary refs log tree commit diff
path: root/nixos/tests/networking.nix
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2020-03-11 00:24:50 +0100
committerFlorian Klink <flokli@flokli.de>2020-03-19 14:15:32 +0100
commit355c58e485e76a4b91bb4613ee2a3e1bae809d28 (patch)
treebac3f457bc9077c22e321129213efde453f43445 /nixos/tests/networking.nix
parentb00b66e262d6e027434d00c8a5296052db4ac46c (diff)
downloadnixpkgs-355c58e485e76a4b91bb4613ee2a3e1bae809d28.tar
nixpkgs-355c58e485e76a4b91bb4613ee2a3e1bae809d28.tar.gz
nixpkgs-355c58e485e76a4b91bb4613ee2a3e1bae809d28.tar.bz2
nixpkgs-355c58e485e76a4b91bb4613ee2a3e1bae809d28.tar.lz
nixpkgs-355c58e485e76a4b91bb4613ee2a3e1bae809d28.tar.xz
nixpkgs-355c58e485e76a4b91bb4613ee2a3e1bae809d28.tar.zst
nixpkgs-355c58e485e76a4b91bb4613ee2a3e1bae809d28.zip
nixos/networkd: respect systemd.network.links also with disabled systemd-networkd
This mirrors the behaviour of systemd - It's udev that parses `.link`
files, not `systemd-networkd`.

This was originally applied in 36ef112a477034fc6d1d9170bf1bcda0140a8d1d,
but was reverted due to 1115959a8d4d73ad73341563dc8bbf52230a281e causing
evaluation errors on hydra.
Diffstat (limited to 'nixos/tests/networking.nix')
-rw-r--r--nixos/tests/networking.nix25
1 files changed, 25 insertions, 0 deletions
diff --git a/nixos/tests/networking.nix b/nixos/tests/networking.nix
index 933a4451af9..0a6507d2dc8 100644
--- a/nixos/tests/networking.nix
+++ b/nixos/tests/networking.nix
@@ -655,6 +655,31 @@ 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 mapAttrs (const (attrs: makeTest (attrs // {