2018-11-11 08:41:11 +00:00
|
|
|
{ system ? builtins.currentSystem,
|
|
|
|
config ? {},
|
|
|
|
pkgs ? import ../.. { inherit system config; }
|
|
|
|
}:
|
2018-02-09 18:40:39 +00:00
|
|
|
|
2018-04-29 13:28:33 +00:00
|
|
|
let
|
2018-11-11 08:41:11 +00:00
|
|
|
inherit (import ../lib/testing.nix { inherit system pkgs; }) makeTest;
|
2018-04-29 13:28:33 +00:00
|
|
|
in pkgs.lib.listToAttrs (pkgs.lib.crossLists (predictable: withNetworkd: {
|
|
|
|
name = pkgs.lib.optionalString (!predictable) "un" + "predictable"
|
|
|
|
+ pkgs.lib.optionalString withNetworkd "Networkd";
|
|
|
|
value = makeTest {
|
|
|
|
name = "${if predictable then "" else "un"}predictableInterfaceNames${if withNetworkd then "-with-networkd" else ""}";
|
|
|
|
meta = {};
|
|
|
|
|
2018-07-20 20:56:59 +00:00
|
|
|
machine = { lib, ... }: {
|
2018-04-29 13:28:33 +00:00
|
|
|
networking.usePredictableInterfaceNames = lib.mkForce predictable;
|
|
|
|
networking.useNetworkd = withNetworkd;
|
|
|
|
networking.dhcpcd.enable = !withNetworkd;
|
|
|
|
};
|
2018-02-09 18:40:39 +00:00
|
|
|
|
2018-04-29 13:28:33 +00:00
|
|
|
testScript = ''
|
|
|
|
print $machine->succeed("ip link");
|
|
|
|
$machine->succeed("ip link show ${if predictable then "ens3" else "eth0"}");
|
|
|
|
$machine->fail("ip link show ${if predictable then "eth0" else "ens3"}");
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
}) [[true false] [true false]])
|