82 lines
1.9 KiB
Nix
82 lines
1.9 KiB
Nix
{
|
|
pkgs,
|
|
self,
|
|
clanLib,
|
|
restic-module,
|
|
...
|
|
}:
|
|
clanLib.test.makeTestClan {
|
|
inherit pkgs self;
|
|
nixosTest = (
|
|
{ ... }:
|
|
{
|
|
|
|
name = "restic";
|
|
|
|
clan = {
|
|
|
|
/*
|
|
# Desired inventory for a complete test:
|
|
inventory = {
|
|
machines = {
|
|
# - Two backup servers (destinations)
|
|
# - Three backup clients:
|
|
# - client_1 and client_2 should backup to both servers
|
|
# - client_3 should only backup to server_2
|
|
server_1 = { };
|
|
server_2 = { };
|
|
client_1.tags = [ "backup_to1" "backup_to2" ];
|
|
client_2.tags = [ "backup_to1" "backup_to2" ];
|
|
client_3.tags = [ "backup_to1" ];
|
|
};
|
|
|
|
services = {
|
|
# Apply roles based on tags for clients
|
|
restic.backup_dest1.roles.client.tags = [ "backup_to1" ];
|
|
restic.backup_dest2.roles.client.tags = [ "backup_to2" ];
|
|
|
|
# Apply roles based on machine names for servers
|
|
restic.backup_dest1.roles.server.machines = ["server_1"];
|
|
restic.backup_dest2.roles.server.machines = ["server_2"];
|
|
};
|
|
};
|
|
*/
|
|
|
|
inventory = {
|
|
|
|
# Define machines
|
|
machines.client_machine = { };
|
|
machines.server_machine = { };
|
|
modules.restic = restic-module;
|
|
|
|
instances.test-restic = {
|
|
|
|
module.name = "restic";
|
|
|
|
roles.server.machines.server_machine = {
|
|
# Server settings
|
|
settings.directory = "/var/lib/restic";
|
|
};
|
|
|
|
roles.client.machines.client_machine = {
|
|
# Client settings
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
directory = ./.;
|
|
};
|
|
|
|
# defaults = { };
|
|
#
|
|
# nodes = { };
|
|
|
|
testScript = ''
|
|
start_all()
|
|
server_machine.wait_for_unit("restic-rest-server")
|
|
'';
|
|
}
|
|
);
|
|
}
|