2020-02-08 11:11:13 +00:00
|
|
|
import ./make-test-python.nix ({ pkgs, lib, ...} : {
|
2016-02-02 18:03:13 +00:00
|
|
|
name = "initrd-network";
|
|
|
|
|
2021-01-10 19:08:30 +00:00
|
|
|
meta.maintainers = [ pkgs.lib.maintainers.eelco ];
|
2016-02-02 18:03:13 +00:00
|
|
|
|
2022-03-20 23:15:30 +00:00
|
|
|
nodes.machine = { ... }: {
|
2016-02-02 18:03:13 +00:00
|
|
|
imports = [ ../modules/profiles/minimal.nix ];
|
|
|
|
boot.initrd.network.enable = true;
|
|
|
|
boot.initrd.network.postCommands =
|
|
|
|
''
|
2020-02-08 11:11:13 +00:00
|
|
|
ip addr show
|
|
|
|
ip route show
|
2016-02-02 18:03:13 +00:00
|
|
|
ip addr | grep 10.0.2.15 || exit 1
|
|
|
|
ping -c1 10.0.2.2 || exit 1
|
|
|
|
'';
|
2020-02-08 11:11:13 +00:00
|
|
|
# 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
|
|
|
|
'';
|
2016-02-02 18:03:13 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
testScript =
|
|
|
|
''
|
2019-12-15 16:02:22 +00:00
|
|
|
start_all()
|
|
|
|
machine.wait_for_unit("multi-user.target")
|
2020-02-08 11:11:13 +00:00
|
|
|
machine.succeed("ip addr show >&2")
|
|
|
|
machine.succeed("ip route show >&2")
|
2016-02-02 18:03:13 +00:00
|
|
|
'';
|
|
|
|
})
|