borgbackup: migrate to clan.nixosTests module
This commit is contained in:
@@ -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") { };
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -114,5 +109,4 @@ nixosLib.runTest (
|
|||||||
clientone.succeed(f"NAME='serverone::borg@serverone:.::{backup_id}' borgbackup-restore >&2")
|
clientone.succeed(f"NAME='serverone::borg@serverone:.::{backup_id}' borgbackup-restore >&2")
|
||||||
assert clientone.succeed("cat /var/test-backups/somefile").strip() == "testing", "restore failed"
|
assert clientone.succeed("cat /var/test-backups/somefile").strip() == "testing", "restore failed"
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
)
|
|
||||||
|
|||||||
Reference in New Issue
Block a user