about summary refs log tree commit diff
path: root/nixos/tests
diff options
context:
space:
mode:
authorpennae <82953136+pennae@users.noreply.github.com>2022-06-04 15:41:03 +0000
committerGitHub <noreply@github.com>2022-06-04 15:41:03 +0000
commit18cce1008e8fdae525d4a3211c58a9da56628dcf (patch)
tree96823a969bea17c2c6480cbdf42905d34a9f0d58 /nixos/tests
parent36baf1559e4618c6f6fea9f2214f1488ed6da890 (diff)
parent3a09010b9d5d7dac68bfca200a9447e1eb77f3eb (diff)
Merge pull request #175743 from scvalex/add-route-type-option
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;