1 import ../make-test-python.nix ({ pkgs, ... }:
5 meta = with pkgs.lib.maintainers; {
6 maintainers = [ nickcao ];
9 nodes.machine = { pkgs, ... }: {
10 services.stratis.enable = true;
11 virtualisation.emptyDiskImages = [ 2048 1024 1024 1024 ];
15 machine.wait_for_unit("stratisd")
17 machine.succeed("stratis pool create testpool /dev/vdb")
18 machine.succeed("stratis pool add-data testpool /dev/vdc")
19 machine.succeed("stratis pool init-cache testpool /dev/vdd")
20 machine.succeed("stratis pool add-cache testpool /dev/vde")
21 # test filesystem creation and rename
22 machine.succeed("stratis filesystem create testpool testfs0")
23 machine.succeed("stratis filesystem rename testpool testfs0 testfs1")
25 machine.succeed("mkdir -p /mnt/testfs1 /mnt/testfs2")
26 machine.wait_for_file("/dev/stratis/testpool/testfs1")
27 machine.succeed("mount /dev/stratis/testpool/testfs1 /mnt/testfs1")
28 machine.succeed("echo test0 > /mnt/testfs1/test0")
29 machine.succeed("echo test1 > /mnt/testfs1/test1")
30 machine.succeed("stratis filesystem snapshot testpool testfs1 testfs2")
31 machine.succeed("echo test2 > /mnt/testfs1/test1")
32 machine.wait_for_file("/dev/stratis/testpool/testfs2")
33 machine.succeed("mount /dev/stratis/testpool/testfs2 /mnt/testfs2")
34 assert "test0" in machine.succeed("cat /mnt/testfs1/test0")
35 assert "test0" in machine.succeed("cat /mnt/testfs2/test0")
36 assert "test2" in machine.succeed("cat /mnt/testfs1/test1")
37 assert "test1" in machine.succeed("cat /mnt/testfs2/test1")