diff --git a/example/zfs-with-vdevs.nix b/example/zfs-with-vdevs.nix index 96750fd..a61680a 100644 --- a/example/zfs-with-vdevs.nix +++ b/example/zfs-with-vdevs.nix @@ -93,8 +93,6 @@ cache = [ "cache" ]; }; }; - # Workaround: cannot import 'zroot': I/O error in disko tests - options.cachefile = "none"; rootFsOptions = { compression = "zstd"; diff --git a/lib/tests.nix b/lib/tests.nix index e2e8f60..0aff420 100644 --- a/lib/tests.nix +++ b/lib/tests.nix @@ -86,7 +86,7 @@ let tsp-config = tsp-generator.config testConfigBooted; num-disks = builtins.length (lib.attrNames testConfigBooted.disko.devices.disk); - installed-system = { ... }: { + installed-system = { config, ... }: { imports = [ (lib.optionalAttrs (testMode == "direct") tsp-config) (lib.optionalAttrs (testMode == "module") { @@ -101,7 +101,8 @@ let # config for tests to make them run faster or work at all documentation.enable = false; hardware.enableAllFirmware = lib.mkForce false; - boot.initrd.preDeviceCommands = '' + # FIXME: we don't have an systemd in stage-1 equialvent for this + boot.initrd.preDeviceCommands = lib.mkIf (!config.boot.initrd.systemd.enable) '' echo -n 'secretsecret' > /tmp/secret.key ''; boot.consoleLogLevel = lib.mkForce 100; diff --git a/lib/types/zpool.nix b/lib/types/zpool.nix index 24d155a..e534db3 100644 --- a/lib/types/zpool.nix +++ b/lib/types/zpool.nix @@ -79,7 +79,7 @@ in }; cache = lib.mkOption { type = lib.types.listOf lib.types.str; - default = null; + default = []; description = '' A dedicated zfs cache device (L2ARC). See https://openzfs.github.io/openzfs-docs/man/master/7/zpoolconcepts.7.html#Cache_Devices diff --git a/tests/zfs-with-vdevs.nix b/tests/zfs-with-vdevs.nix index dbca4fc..da301a0 100644 --- a/tests/zfs-with-vdevs.nix +++ b/tests/zfs-with-vdevs.nix @@ -8,6 +8,15 @@ diskoLib.testLib.makeDiskoTest { extraInstallerConfig.networking.hostId = "8425e349"; extraSystemConfig = { networking.hostId = "8425e349"; + # It looks like the 60s of NixOS is sometimes not enough for our virtio-based zpool. + # This fixes the flakeiness of the test. + boot.initrd.postResumeCommands = '' + for i in $(seq 1 120); do + if zpool list | grep -q zroot || zpool import -N zroot; then + break + fi + done + ''; }; extraTestScript = '' def assert_property(ds, property, expected_value):