mirror of
https://github.com/TECHNOFAB11/disko.git
synced 2025-12-12 16:10:03 +01:00
tests: add lib, autoimport tests
This commit is contained in:
parent
e4836108d5
commit
1ac0e76b15
7 changed files with 82 additions and 172 deletions
|
|
@ -1,38 +1,9 @@
|
|||
{ 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/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
|
||||
extraTestScript = ''
|
||||
machine.succeed("test -e /mnt/test");
|
||||
machine.succeed("btrfs subvolume list /mnt | grep -qs 'path test$'");
|
||||
'';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue