Move the mycelium clanService test to the mycelium clan service. The tests should live close to the definition of the service, so that debugging and discoverability is better.
54 lines
1.0 KiB
Nix
54 lines
1.0 KiB
Nix
{
|
|
pkgs,
|
|
nixosLib,
|
|
clan-core,
|
|
...
|
|
}:
|
|
nixosLib.runTest (
|
|
{ ... }:
|
|
{
|
|
imports = [
|
|
clan-core.modules.nixosVmTest.clanTest
|
|
];
|
|
|
|
hostPkgs = pkgs;
|
|
|
|
name = "mycelium";
|
|
|
|
clan = {
|
|
|
|
test.useContainers = false;
|
|
directory = ./.;
|
|
modules."@clan/mycelium" = ../../default.nix;
|
|
inventory = {
|
|
machines.server = { };
|
|
|
|
instances = {
|
|
mycelium-test = {
|
|
module.name = "@clan/mycelium";
|
|
roles.peer.machines."server".settings = {
|
|
openFirewall = true;
|
|
addHostedPublicNodes = true;
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
|
|
nodes = {
|
|
server = { };
|
|
};
|
|
|
|
testScript = ''
|
|
start_all()
|
|
|
|
# Check that mycelium service is running
|
|
server.wait_for_unit("mycelium")
|
|
server.succeed("systemctl status mycelium")
|
|
|
|
# Check that mycelium is listening on its default port
|
|
server.wait_until_succeeds("${pkgs.iproute2}/bin/ss -tulpn | grep -q 'mycelium'", 10)
|
|
'';
|
|
}
|
|
)
|