borgbackup: migrate to clan.nixosTests module

This commit is contained in:
Jörg Thalheim
2025-06-17 19:04:34 +02:00
parent fe1c9c3c74
commit 54b7822a7d
2 changed files with 96 additions and 101 deletions

View File

@@ -1,17 +1,18 @@
{ lib, self, ... }: { lib, ... }:
let
module = lib.modules.importApply ./default.nix { };
in
{ {
clan.modules = { clan.modules = {
borgbackup = lib.modules.importApply ./default.nix { }; borgbackup = module;
}; };
perSystem = perSystem =
{ pkgs, ... }: { ... }:
{ {
checks = lib.optionalAttrs (pkgs.stdenv.isLinux) { clan.nixosTests.borgbackup = {
borgbackup = import ./tests/vm/default.nix { imports = [ ./tests/vm/default.nix ];
inherit pkgs;
clan-core = self; clan.modules."@clan/borgbackup" = module;
nixosLib = import (self.inputs.nixpkgs + "/nixos/lib") { };
};
}; };
}; };
} }

View File

@@ -1,24 +1,14 @@
{ {
module,
pkgs, pkgs,
nixosLib,
clan-core,
... ...
}: }:
nixosLib.runTest (
{ ... }:
{ {
imports = [
clan-core.modules.nixosVmTest.clanTest
];
hostPkgs = pkgs;
name = "borgbackup"; name = "borgbackup";
clan = { clan = {
directory = ./.; directory = ./.;
test.useContainers = true; test.useContainers = true;
modules."@clan/borgbackup" = ../../default.nix;
inventory = { inventory = {
machines.clientone = { }; machines.clientone = { };
@@ -45,7 +35,12 @@ nixosLib.runTest (
}; };
clientone = clientone =
{ config, pkgs, ... }: {
config,
pkgs,
clan-core,
...
}:
let let
dependencies = [ dependencies = [
clan-core clan-core
@@ -115,4 +110,3 @@ nixosLib.runTest (
assert clientone.succeed("cat /var/test-backups/somefile").strip() == "testing", "restore failed" assert clientone.succeed("cat /var/test-backups/somefile").strip() == "testing", "restore failed"
''; '';
} }
)