mirror of
https://github.com/TECHNOFAB11/disko.git
synced 2025-12-12 08:00:05 +01:00
add zfs support/test/example
This commit is contained in:
parent
dd99e29edc
commit
83fb8f661e
3 changed files with 143 additions and 3 deletions
40
tests/zfs.nix
Normal file
40
tests/zfs.nix
Normal file
|
|
@ -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/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
|
||||
machine.succeed("test -b /dev/zvol/zroot/zfs_testvolume");
|
||||
machine.succeed("grep -qs '/mnt/ext4onzfs' /proc/mounts");
|
||||
'';
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue