python3Packages.orjson: Disable failing tests on 32 bit
[NixPkgs.git] / nixos / tests / overlayfs.nix
blob6dab6760c5b990e3055d76b8fae5eb1fe2f2d2d9
1 import ./make-test-python.nix ({ pkgs, ... }: {
2   name = "overlayfs";
3   meta.maintainers = with pkgs.lib.maintainers; [ bachp ];
5   nodes.machine = { pkgs, ... }: {
6     virtualisation.emptyDiskImages = [ 512 ];
7     networking.hostId = "deadbeef";
8     environment.systemPackages = with pkgs; [ parted ];
9   };
11   testScript = ''
12     machine.succeed("ls /dev")
14     machine.succeed("mkdir -p /tmp/mnt")
16     # Test ext4 + overlayfs
17     machine.succeed(
18       'mkfs.ext4 -F -L overlay-ext4 /dev/vdb',
19       'mount -t ext4 /dev/vdb /tmp/mnt',
20       'mkdir -p /tmp/mnt/upper /tmp/mnt/lower /tmp/mnt/work /tmp/mnt/merged',
21       # Setup some existing files
22       'echo Replace > /tmp/mnt/lower/replace.txt',
23       'echo Append > /tmp/mnt/lower/append.txt',
24       'echo Overwrite > /tmp/mnt/lower/overwrite.txt',
25       'mount -t overlay overlay -o lowerdir=/tmp/mnt/lower,upperdir=/tmp/mnt/upper,workdir=/tmp/mnt/work /tmp/mnt/merged',
26       # Test new
27       'echo New > /tmp/mnt/merged/new.txt',
28       '[[ "$(cat /tmp/mnt/merged/new.txt)" == New ]]',
29       # Test replace
30       '[[ "$(cat /tmp/mnt/merged/replace.txt)" == Replace ]]',
31       'echo Replaced > /tmp/mnt/merged/replace-tmp.txt',
32       'mv /tmp/mnt/merged/replace-tmp.txt /tmp/mnt/merged/replace.txt',
33       '[[ "$(cat /tmp/mnt/merged/replace.txt)" == Replaced ]]',
34       # Overwrite
35       '[[ "$(cat /tmp/mnt/merged/overwrite.txt)" == Overwrite ]]',
36       'echo Overwritten > /tmp/mnt/merged/overwrite.txt',
37       '[[ "$(cat /tmp/mnt/merged/overwrite.txt)" == Overwritten ]]',
38       # Test append
39       '[[ "$(cat /tmp/mnt/merged/append.txt)" == Append ]]',
40       'echo ed >> /tmp/mnt/merged/append.txt',
41       '[[ "$(cat /tmp/mnt/merged/append.txt)" == "Append\ned" ]]',
42       'umount /tmp/mnt/merged',
43       'umount /tmp/mnt',
44       'udevadm settle',
45     )
46   '';