3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/nixos/tests/initrd-network.nix
Franz Pletz ea7d02406b
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.
2020-02-08 14:04:02 +01:00

34 lines
857 B
Nix

import ./make-test-python.nix ({ pkgs, lib, ...} : {
name = "initrd-network";
meta.maintainers = [ pkgs.stdenv.lib.maintainers.eelco ];
machine = { ... }: {
imports = [ ../modules/profiles/minimal.nix ];
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 addr show >&2")
machine.succeed("ip route show >&2")
'';
})