tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
0
fork
atom
lol
0
fork
atom
overview
issues
pulls
pipelines
nixos/stratis: add test for encryption support
Nick Cao
3 years ago
732950b2
8db1ad78
+34
2 changed files
expand all
collapse all
unified
split
nixos
tests
stratis
default.nix
encryption.nix
+1
nixos/tests/stratis/default.nix
···
4
4
5
5
{
6
6
simple = import ./simple.nix { inherit system pkgs; };
7
7
+
encryption = import ./encryption.nix { inherit system pkgs; };
7
8
}
+33
nixos/tests/stratis/encryption.nix
···
1
1
+
import ../make-test-python.nix ({ pkgs, ... }:
2
2
+
{
3
3
+
name = "stratis";
4
4
+
5
5
+
meta = with pkgs.lib.maintainers; {
6
6
+
maintainers = [ nickcao ];
7
7
+
};
8
8
+
9
9
+
nodes.machine = { pkgs, ... }: {
10
10
+
services.stratis.enable = true;
11
11
+
virtualisation.emptyDiskImages = [ 2048 ];
12
12
+
};
13
13
+
14
14
+
testScript =
15
15
+
let
16
16
+
testkey1 = pkgs.writeText "testkey1" "supersecret1";
17
17
+
testkey2 = pkgs.writeText "testkey2" "supersecret2";
18
18
+
in
19
19
+
''
20
20
+
machine.wait_for_unit("stratisd")
21
21
+
# test creation of encrypted pool and filesystem
22
22
+
machine.succeed("stratis key set testkey1 --keyfile-path ${testkey1}")
23
23
+
machine.succeed("stratis key set testkey2 --keyfile-path ${testkey2}")
24
24
+
machine.succeed("stratis pool create testpool /dev/vdb --key-desc testkey1")
25
25
+
machine.succeed("stratis fs create testpool testfs")
26
26
+
# test rebinding encrypted pool
27
27
+
machine.succeed("stratis pool rebind keyring testpool testkey2")
28
28
+
# test restarting encrypted pool
29
29
+
uuid = machine.succeed("stratis pool list | grep -oE '[0-9a-fA-F-]{36}'").rstrip('\n')
30
30
+
machine.succeed(" stratis pool stop testpool")
31
31
+
machine.succeed(f"stratis pool start {uuid} --unlock-method keyring")
32
32
+
'';
33
33
+
})