Tests: migrate backup tests to use inventory
This commit is contained in:
committed by
clan-bot
parent
212c899767
commit
186e81d8b9
@@ -5,6 +5,12 @@
|
|||||||
fileSystems."/".device = "/dev/null";
|
fileSystems."/".device = "/dev/null";
|
||||||
boot.loader.grub.device = "/dev/null";
|
boot.loader.grub.device = "/dev/null";
|
||||||
};
|
};
|
||||||
|
clan.inventory.services = {
|
||||||
|
borgbackup.test-backup = {
|
||||||
|
roles.client.machines = [ "test-backup" ];
|
||||||
|
roles.server.machines = [ "test-backup" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
flake.nixosModules = {
|
flake.nixosModules = {
|
||||||
test-backup =
|
test-backup =
|
||||||
{
|
{
|
||||||
@@ -22,9 +28,18 @@
|
|||||||
in
|
in
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
self.clanModules.borgbackup
|
# Do not import inventory modules. They should be configured via 'clan.inventory'
|
||||||
|
#
|
||||||
|
# TODO: Configure localbackup via inventory
|
||||||
self.clanModules.localbackup
|
self.clanModules.localbackup
|
||||||
];
|
];
|
||||||
|
# Borgbackup overrides
|
||||||
|
services.borgbackup.repos.test-backups = {
|
||||||
|
path = "/var/lib/borgbackup/test-backups";
|
||||||
|
authorizedKeys = [ (builtins.readFile ../lib/ssh/pubkey) ];
|
||||||
|
};
|
||||||
|
clan.borgbackup.destinations.test-backup.repo = lib.mkForce "borg@machine:.";
|
||||||
|
|
||||||
clan.core.networking.targetHost = "machine";
|
clan.core.networking.targetHost = "machine";
|
||||||
networking.hostName = "machine";
|
networking.hostName = "machine";
|
||||||
nixpkgs.hostPlatform = "x86_64-linux";
|
nixpkgs.hostPlatform = "x86_64-linux";
|
||||||
@@ -108,7 +123,6 @@
|
|||||||
'';
|
'';
|
||||||
folders = [ "/var/test-service" ];
|
folders = [ "/var/test-service" ];
|
||||||
};
|
};
|
||||||
clan.borgbackup.destinations.test-backup.repo = "borg@machine:.";
|
|
||||||
|
|
||||||
fileSystems."/mnt/external-disk" = {
|
fileSystems."/mnt/external-disk" = {
|
||||||
device = "/dev/vdb"; # created in tests with virtualisation.emptyDisks
|
device = "/dev/vdb"; # created in tests with virtualisation.emptyDisks
|
||||||
@@ -129,11 +143,6 @@
|
|||||||
touch /run/unmount-external-disk
|
touch /run/unmount-external-disk
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
services.borgbackup.repos.test-backups = {
|
|
||||||
path = "/var/lib/borgbackup/test-backups";
|
|
||||||
authorizedKeys = [ (builtins.readFile ../lib/ssh/pubkey) ];
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
perSystem =
|
perSystem =
|
||||||
@@ -171,10 +180,15 @@
|
|||||||
test-backups = (import ../lib/container-test.nix) {
|
test-backups = (import ../lib/container-test.nix) {
|
||||||
name = "test-backups";
|
name = "test-backups";
|
||||||
nodes.machine = {
|
nodes.machine = {
|
||||||
imports = [
|
imports =
|
||||||
|
[
|
||||||
self.nixosModules.clanCore
|
self.nixosModules.clanCore
|
||||||
|
# Some custom overrides for the backup tests
|
||||||
self.nixosModules.test-backup
|
self.nixosModules.test-backup
|
||||||
];
|
]
|
||||||
|
++
|
||||||
|
# import the inventory generated nixosModules
|
||||||
|
self.clanInternals.serviceConfigs.machines.test-backup.machineImports;
|
||||||
clan.core.settings.directory = ./.;
|
clan.core.settings.directory = ./.;
|
||||||
environment.systemPackages = [
|
environment.systemPackages = [
|
||||||
(pkgs.writeShellScriptBin "foo" ''
|
(pkgs.writeShellScriptBin "foo" ''
|
||||||
|
|||||||
Reference in New Issue
Block a user