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 = {
localsend = lib.modules.importApply ./default.nix { };
localsend = module;
};
perSystem =
{ pkgs, ... }:
{ ... }:
{
checks = lib.optionalAttrs (pkgs.stdenv.isLinux) {
localsend = import ./tests/vm/default.nix {
inherit pkgs;
clan-core = self;
nixosLib = import (self.inputs.nixpkgs + "/nixos/lib") { };
};
clan.nixosTests.localsend = {
imports = [ ./tests/vm/default.nix ];
clan.modules."@clan/localsend" = module;
};
};
}

View File

@@ -1,51 +1,38 @@
{
pkgs,
nixosLib,
clan-core,
module,
...
}:
{
name = "localsend";
nixosLib.runTest (
{ ... }:
{
imports = [
clan-core.modules.nixosVmTest.clanTest
];
clan = {
directory = ./.;
inventory = {
machines.server = { };
hostPkgs = pkgs;
name = "localsend";
clan = {
directory = ./.;
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";
};
instances = {
localsend-test = {
module.name = "@clan/localsend";
roles.default.machines."server".settings = {
displayName = "Test Instance";
ipv4Addr = "192.168.56.2/24";
};
};
};
};
};
nodes = {
server = { };
};
nodes = {
server = { };
};
testScript = ''
start_all()
testScript = ''
start_all()
# Check that the localsend wrapper script is available
server.succeed("command -v localsend")
# Check that the localsend wrapper script is available
server.succeed("command -v localsend")
# 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")
'';
}
)
# 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")
'';
}