summaryrefslogtreecommitdiffstats
path: root/tests/zfs.nix
diff options
context:
space:
mode:
authorlassulus <lassulus@lassul.us>2022-08-25 23:12:49 +0200
committerlassulus <lassulus@lassul.us>2022-08-25 23:31:05 +0200
commit1ac0e76b15a3b13c83d25a78b32dee4070a584b7 (patch)
treea86c9a51c3c0901c2bf1054bec79f25a6c399ea4 /tests/zfs.nix
parente4836108d51a4339983c0f88fb4e995e4109bb21 (diff)
tests: add lib, autoimport tests
Diffstat (limited to 'tests/zfs.nix')
-rw-r--r--tests/zfs.nix38
1 files changed, 4 insertions, 34 deletions
diff --git a/tests/zfs.nix b/tests/zfs.nix
index bc807bc..3c8216c 100644
--- a/tests/zfs.nix
+++ b/tests/zfs.nix
@@ -1,40 +1,10 @@
-{ makeTest ? import <nixpkgs/nixos/tests/make-test-python.nix>
-, pkgs ? (import <nixpkgs> {})
+{ pkgs ? (import <nixpkgs> {})
+, makeDiskoTest ? (pkgs.callPackage ./lib.nix {}).makeDiskoTest
}:
-let
- makeTest' = args:
- makeTest args {
- inherit pkgs;
- inherit (pkgs) system;
- };
+makeDiskoTest {
disko-config = import ../example/zfs.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 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
+ extraTestScript = ''
machine.succeed("test -b /dev/zvol/zroot/zfs_testvolume");
machine.succeed("grep -qs '/mnt/ext4onzfs' /proc/mounts");
'';
}
-