about summary refs log tree commit diff
path: root/nixos/tests
diff options
context:
space:
mode:
authorAlexandru Scvortov <code@scvalex.net>2022-06-02 19:16:25 +0100
committerAlexandru Scvortov <code@scvalex.net>2022-06-02 19:16:25 +0100
commit3a09010b9d5d7dac68bfca200a9447e1eb77f3eb (patch)
tree85e73e397d8c92e77232c24eee5a2e9a81ee58b8 /nixos/tests
parent42cfcd1d78b0139a46396010ebf81dd38e6f76be (diff)
nixos/network-interfaces: add networking.interfaces.<name>.ipv[46].routes.type
Diffstat (limited to 'nixos/tests')
-rw-r--r--nixos/tests/networking.nix29
1 files changed, 25 insertions, 4 deletions
diff --git a/nixos/tests/networking.nix b/nixos/tests/networking.nix
index 2cc1e9b0942ca..1fe1229f24a4a 100644
--- a/nixos/tests/networking.nix
+++ b/nixos/tests/networking.nix
@@ -77,12 +77,14 @@ let
   testCases = {
     loopback = {
       name = "Loopback";
-      machine.networking.useDHCP = false;
-      machine.networking.useNetworkd = networkd;
+      nodes.client = { pkgs, ... }: with pkgs.lib; {
+        networking.useDHCP = false;
+        networking.useNetworkd = networkd;
+      };
       testScript = ''
         start_all()
-        machine.wait_for_unit("network.target")
-        loopback_addresses = machine.succeed("ip addr show lo")
+        client.wait_for_unit("network.target")
+        loopback_addresses = client.succeed("ip addr show lo")
         assert "inet 127.0.0.1/8" in loopback_addresses
         assert "inet6 ::1/128" in loopback_addresses
       '';
@@ -139,6 +141,25 @@ let
               client.wait_until_succeeds("ping -c 1 192.168.3.1")
         '';
     };
+    routeType = {
+      name = "RouteType";
+      nodes.client = { pkgs, ... }: with pkgs.lib; {
+        networking = {
+          useDHCP = false;
+          useNetworkd = networkd;
+          interfaces.eth1.ipv4.routes = [{
+            address = "192.168.1.127";
+            prefixLength = 32;
+            type = "local";
+          }];
+        };
+      };
+      testScript = ''
+        start_all()
+        client.wait_for_unit("network.target")
+        client.succeed("ip -4 route list table local | grep 'local 192.168.1.127'")
+      '';
+    };
     dhcpDefault = {
       name = "useDHCP-by-default";
       nodes.router = router;