1{ system ? builtins.currentSystem,
2 config ? {},
3 pkgs ? import ../.. { inherit system config; }
4}:
5
6let
7 inherit (import ../lib/testing-python.nix { inherit system pkgs; }) makeTest;
8 testCombinations = pkgs.lib.cartesianProductOfSets {
9 predictable = [true false];
10 withNetworkd = [true false];
11 };
12in pkgs.lib.listToAttrs (builtins.map ({ predictable, withNetworkd }: {
13 name = pkgs.lib.optionalString (!predictable) "un" + "predictable"
14 + pkgs.lib.optionalString withNetworkd "Networkd";
15 value = makeTest {
16 name = "${if predictable then "" else "un"}predictableInterfaceNames${if withNetworkd then "-with-networkd" else ""}";
17 meta = {};
18
19 nodes.machine = { lib, ... }: {
20 networking.usePredictableInterfaceNames = lib.mkForce predictable;
21 networking.useNetworkd = withNetworkd;
22 networking.dhcpcd.enable = !withNetworkd;
23 networking.useDHCP = !withNetworkd;
24
25 # Check if predictable interface names are working in stage-1
26 boot.initrd.postDeviceCommands = ''
27 ip link
28 ip link show eth0 ${if predictable then "&&" else "||"} exit 1
29 '';
30 };
31
32 testScript = ''
33 print(machine.succeed("ip link"))
34 machine.${if predictable then "fail" else "succeed"}("ip link show eth0")
35 '';
36 };
37}) testCombinations)