2018-11-11 09:41:11 +01:00
|
|
|
{ system ? builtins.currentSystem,
|
|
|
|
config ? {},
|
|
|
|
pkgs ? import ../.. { inherit system config; }
|
|
|
|
}:
|
2018-02-09 19:40:39 +01:00
|
|
|
|
2018-04-29 15:28:33 +02:00
|
|
|
let
|
2018-11-11 09:41:11 +01:00
|
|
|
inherit (import ../lib/testing.nix { inherit system pkgs; }) makeTest;
|
2018-04-29 15:28:33 +02: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 22:56:59 +02:00
|
|
|
machine = { lib, ... }: {
|
2018-04-29 15:28:33 +02:00
|
|
|
networking.usePredictableInterfaceNames = lib.mkForce predictable;
|
|
|
|
networking.useNetworkd = withNetworkd;
|
|
|
|
networking.dhcpcd.enable = !withNetworkd;
|
|
|
|
};
|
2018-02-09 19:40:39 +01:00
|
|
|
|
2018-04-29 15:28:33 +02: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]])
|