localsend: migrate to clan.nixosTests module

This commit is contained in:
Jörg Thalheim
2025-06-17 19:29:08 +02:00
parent 5d4dc437c2
commit 6bc4523835
2 changed files with 35 additions and 47 deletions

View File

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

View File

@@ -1,51 +1,38 @@
{ {
pkgs, module,
nixosLib,
clan-core,
... ...
}: }:
{
name = "localsend";
nixosLib.runTest ( clan = {
{ ... }: directory = ./.;
{ inventory = {
imports = [ machines.server = { };
clan-core.modules.nixosVmTest.clanTest
];
hostPkgs = pkgs; instances = {
localsend-test = {
name = "localsend"; module.name = "@clan/localsend";
roles.default.machines."server".settings = {
clan = { displayName = "Test Instance";
directory = ./.; ipv4Addr = "192.168.56.2/24";
modules."@clan/localsend" = ../../default.nix;
inventory = {
machines.server = { };
instances = {
localsend-test = {
module.name = "@clan/localsend";
roles.default.machines."server".settings = {
displayName = "Test Instance";
ipv4Addr = "192.168.56.2/24";
};
}; };
}; };
}; };
}; };
};
nodes = { nodes = {
server = { }; server = { };
}; };
testScript = '' testScript = ''
start_all() start_all()
# Check that the localsend wrapper script is available # Check that the localsend wrapper script is available
server.succeed("command -v localsend") server.succeed("command -v localsend")
# Verify the 09-zerotier network is configured with the specified IP address # Verify the 09-zerotier network is configured with the specified IP address
server.succeed("grep -q 'Address=192.168.56.2/24' /etc/systemd/network/09-zerotier.network") server.succeed("grep -q 'Address=192.168.56.2/24' /etc/systemd/network/09-zerotier.network")
''; '';
} }
)