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