diff options
author | lassulus <lassulus@lassul.us> | 2022-08-25 21:46:17 +0200 |
---|---|---|
committer | lassulus <lassulus@lassul.us> | 2022-08-25 23:31:05 +0200 |
commit | 81e704b638a8a7158bd9106b7fd592fb982d1864 (patch) | |
tree | c34dd63211532f349fcc5b8b2421188975a67623 /tests | |
parent | dadc49133042834dada6eafc98dcb1f7f2c5e43b (diff) |
add btrfs subvolumes
Diffstat (limited to 'tests')
-rw-r--r-- | tests/btrfs-subvolumes.nix | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/btrfs-subvolumes.nix b/tests/btrfs-subvolumes.nix new file mode 100644 index 0000000..6527329 --- /dev/null +++ b/tests/btrfs-subvolumes.nix @@ -0,0 +1,40 @@ +{ makeTest ? import <nixpkgs/nixos/tests/make-test-python.nix> +, pkgs ? (import <nixpkgs> {}) +}: +let + makeTest' = args: + makeTest args { + inherit pkgs; + inherit (pkgs) system; + }; + disko-config = import ../example/btrfs-subvolumes.nix; + tsp-create = pkgs.writeScript "create" ((pkgs.callPackage ../. {}).create disko-config); + tsp-mount = pkgs.writeScript "mount" ((pkgs.callPackage ../. {}).mount disko-config); +in makeTest' { + name = "disko"; + + nodes.machine = + { config, pkgs, modulesPath, ... }: + + { + imports = [ + (modulesPath + "/profiles/installation-device.nix") + (modulesPath + "/profiles/base.nix") + ]; + + # speed-up eval + documentation.enable = false; + + virtualisation.emptyDiskImages = [ 512 ]; + }; + + testScript = '' + machine.succeed("echo 'secret' > /tmp/secret.key"); + machine.succeed("${tsp-create}"); + machine.succeed("${tsp-mount}"); + machine.succeed("${tsp-mount}"); # verify that the command is idempotent + machine.succeed("test -e /mnt/test"); + machine.succeed("btrfs subvolume list /mnt | grep -qs 'path test$'"); + ''; +} + |