diff options
author | Franz Pletz <fpletz@fnordicwalking.de> | 2020-02-08 12:11:13 +0100 |
---|---|---|
committer | Franz Pletz <fpletz@fnordicwalking.de> | 2020-02-08 14:04:02 +0100 |
commit | ea7d02406b000b8b9a951fba262174492ff4572f (patch) | |
tree | b76019d5f4f223eff872c9523446941db62f42d5 /nixos/tests | |
parent | 44e289f93bcf6d04c3eab231bac57dade06fc0c6 (diff) | |
download | nixlib-ea7d02406b000b8b9a951fba262174492ff4572f.tar nixlib-ea7d02406b000b8b9a951fba262174492ff4572f.tar.gz nixlib-ea7d02406b000b8b9a951fba262174492ff4572f.tar.bz2 nixlib-ea7d02406b000b8b9a951fba262174492ff4572f.tar.lz nixlib-ea7d02406b000b8b9a951fba262174492ff4572f.tar.xz nixlib-ea7d02406b000b8b9a951fba262174492ff4572f.tar.zst nixlib-ea7d02406b000b8b9a951fba262174492ff4572f.zip |
nixos/initrd-network: flush interfaces before stage 2
Depending on the network management backend being used, if the interface configuration in stage 1 is not cleared, there might still be some old addresses or routes from stage 1 present in stage 2 after network configuration has finished.
Diffstat (limited to 'nixos/tests')
-rw-r--r-- | nixos/tests/initrd-network.nix | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/nixos/tests/initrd-network.nix b/nixos/tests/initrd-network.nix index 4796ff9b7c8d..9c35b7305768 100644 --- a/nixos/tests/initrd-network.nix +++ b/nixos/tests/initrd-network.nix @@ -1,4 +1,4 @@ -import ./make-test-python.nix ({ pkgs, ...} : { +import ./make-test-python.nix ({ pkgs, lib, ...} : { name = "initrd-network"; meta.maintainers = [ pkgs.stdenv.lib.maintainers.eelco ]; @@ -8,15 +8,26 @@ import ./make-test-python.nix ({ pkgs, ...} : { boot.initrd.network.enable = true; boot.initrd.network.postCommands = '' + ip addr show + ip route show ip addr | grep 10.0.2.15 || exit 1 ping -c1 10.0.2.2 || exit 1 ''; + # Check if cleanup was done correctly + boot.initrd.postMountCommands = lib.mkAfter + '' + ip addr show + ip route show + ip addr | grep 10.0.2.15 && exit 1 + ping -c1 10.0.2.2 && exit 1 + ''; }; testScript = '' start_all() machine.wait_for_unit("multi-user.target") - machine.succeed("ip link >&2") + machine.succeed("ip addr show >&2") + machine.succeed("ip route show >&2") ''; }) |