@@ -1,27 +1,24 @@
1−{ system ? builtins.currentSystem
2−, pkgs ? import ../.. { inherit system; }
3−}:
4−with import ../lib/testing.nix { inherit system; };
5−let boolToString = x: if x then "yes" else "no"; in
6−let testWhenSetTo = predictable: withNetworkd:
7−makeTest {
8− name = "${if predictable then "" else "un"}predictableInterfaceNames${if withNetworkd then "-with-networkd" else ""}";
9− meta = {};
1+{ system ? builtins.currentSystem }:
102
11− machine = { config, pkgs, ... }: {
12− networking.usePredictableInterfaceNames = pkgs.stdenv.lib.mkForce predictable;
13− networking.useNetworkd = withNetworkd;
14− networking.dhcpcd.enable = !withNetworkd;
15− };
3+let
4+ inherit (import ../lib/testing.nix { inherit system; }) makeTest pkgs;
5+in pkgs.lib.listToAttrs (pkgs.lib.crossLists (predictable: withNetworkd: {
6+ name = pkgs.lib.optionalString (!predictable) "un" + "predictable"
7+ + pkgs.lib.optionalString withNetworkd "Networkd";
8+ value = makeTest {
9+ name = "${if predictable then "" else "un"}predictableInterfaceNames${if withNetworkd then "-with-networkd" else ""}";
10+ meta = {};
11+
12+ machine = { config, lib, ... }: {
13+ networking.usePredictableInterfaceNames = lib.mkForce predictable;
14+ networking.useNetworkd = withNetworkd;
15+ networking.dhcpcd.enable = !withNetworkd;
16+ };
1617
17− testScript = ''
18− print $machine->succeed("ip link");
19− $machine->succeed("ip link show ${if predictable then "ens3" else "eth0"}");
20− $machine->fail("ip link show ${if predictable then "eth0" else "ens3"}");
21− '';
22−}; in
23−with pkgs.stdenv.lib.lists;
24−with pkgs.stdenv.lib.attrsets;
25−listToAttrs (map (drv: nameValuePair drv.name drv) (
26−crossLists testWhenSetTo [[true false] [true false]]
27−))
18+ testScript = ''
19+ print $machine->succeed("ip link");
20+ $machine->succeed("ip link show ${if predictable then "ens3" else "eth0"}");
21+ $machine->fail("ip link show ${if predictable then "eth0" else "ens3"}");
22+ '';
23+ };
24+}) [[true false] [true false]])