mirror of
https://github.com/NixOS/nix.git
synced 2024-11-21 14:22:29 +00:00
Add a VM test for fsync-store-paths
Based on https://github.com/squalus/nix-durability-tests/blob/master/flake.nix.
This commit is contained in:
parent
21a164aa03
commit
9ff0b55d4e
@ -155,4 +155,6 @@ in
|
||||
user-sandboxing = runNixOSTestFor "x86_64-linux" ./user-sandboxing;
|
||||
|
||||
s3-binary-cache-store = runNixOSTestFor "x86_64-linux" ./s3-binary-cache-store.nix;
|
||||
|
||||
fsync = runNixOSTestFor "x86_64-linux" ./fsync.nix;
|
||||
}
|
||||
|
39
tests/nixos/fsync.nix
Normal file
39
tests/nixos/fsync.nix
Normal file
@ -0,0 +1,39 @@
|
||||
{ lib, config, nixpkgs, pkgs, ... }:
|
||||
|
||||
let
|
||||
pkg1 = pkgs.go;
|
||||
in
|
||||
|
||||
{
|
||||
name = "fsync";
|
||||
|
||||
nodes.machine =
|
||||
{ config, lib, pkgs, ... }:
|
||||
{ virtualisation.emptyDiskImages = [ 1024 ];
|
||||
environment.systemPackages = [ pkg1 ];
|
||||
nix.settings.experimental-features = [ "nix-command" ];
|
||||
nix.settings.fsync-store-paths = true;
|
||||
nix.settings.require-sigs = false;
|
||||
boot.supportedFilesystems = [ "ext4" "btrfs" "xfs" ];
|
||||
};
|
||||
|
||||
testScript = { nodes }: ''
|
||||
# fmt: off
|
||||
for fs in ("ext4", "btrfs", "xfs"):
|
||||
machine.succeed("mkfs.{} {} /dev/vdb".format(fs, "-F" if fs == "ext4" else "-f"))
|
||||
machine.succeed("mkdir -p /mnt")
|
||||
machine.succeed("mount /dev/vdb /mnt")
|
||||
machine.succeed("sync")
|
||||
machine.succeed("nix copy --offline ${pkg1} --to /mnt")
|
||||
machine.crash()
|
||||
|
||||
machine.start()
|
||||
machine.wait_for_unit("multi-user.target")
|
||||
machine.succeed("mkdir -p /mnt")
|
||||
machine.succeed("mount /dev/vdb /mnt")
|
||||
machine.succeed("nix path-info --offline --store /mnt ${pkg1}")
|
||||
machine.succeed("nix store verify --all --store /mnt --no-trust")
|
||||
|
||||
machine.succeed("umount /dev/vdb")
|
||||
'';
|
||||
}
|
Loading…
Reference in New Issue
Block a user