Merge pull request #805 from nix-community/zfs-fix

Fix flaky zfs test
This commit is contained in:
Felix Uhl 2024-10-01 19:34:16 +02:00 committed by GitHub
commit 037be88911
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 13 additions and 5 deletions

View file

@ -93,8 +93,6 @@
cache = [ "cache" ];
};
};
# Workaround: cannot import 'zroot': I/O error in disko tests
options.cachefile = "none";
rootFsOptions = {
compression = "zstd";

View file

@ -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;

View file

@ -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

View file

@ -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):