1import ../make-test-python.nix (
2 { pkgs, ... }:
3 {
4 name = "stratis";
5
6 meta = with pkgs.lib.maintainers; {
7 maintainers = [ nickcao ];
8 };
9
10 nodes.machine =
11 { pkgs, ... }:
12 {
13 services.stratis.enable = true;
14 virtualisation.emptyDiskImages = [ 2048 ];
15 };
16
17 testScript =
18 let
19 testkey1 = pkgs.writeText "testkey1" "supersecret1";
20 testkey2 = pkgs.writeText "testkey2" "supersecret2";
21 in
22 ''
23 machine.wait_for_unit("stratisd")
24 # test creation of encrypted pool and filesystem
25 machine.succeed("stratis key set testkey1 --keyfile-path ${testkey1}")
26 machine.succeed("stratis key set testkey2 --keyfile-path ${testkey2}")
27 machine.succeed("stratis pool create testpool /dev/vdb --key-desc testkey1")
28 machine.succeed("stratis fs create testpool testfs")
29 # test rebinding encrypted pool
30 machine.succeed("stratis pool rebind keyring testpool testkey2")
31 # test restarting encrypted pool
32 machine.succeed("stratis pool stop --name testpool")
33 machine.succeed("stratis pool start --name testpool --unlock-method any")
34 '';
35 }
36)