cluster/services/wireguard: test in simulacrum

This commit is contained in:
Max Headroom 2024-08-13 18:51:26 +02:00
parent d54914063e
commit ee2e74a649
2 changed files with 29 additions and 0 deletions

View file

@ -93,5 +93,9 @@ in
nodes = config.services.wireguard.nodes.mesh;
shared = false;
};
simulacrum = {
enable = true;
settings = ./test.nix;
};
};
}

View file

@ -0,0 +1,25 @@
{ cluster, lib, ... }:
{
testScript = ''
${lib.pipe cluster.config.services.wireguard.nodes.mesh [
(map (node: /*python*/ ''
${node}.wait_for_unit("wireguard-wgmesh.target")
''))
(lib.concatStringsSep "\n")
]}
${lib.pipe cluster.config.services.wireguard.nodes.mesh [
(map (node: /*python*/ ''
with subtest("${node} can reach all other nodes"):
${lib.pipe (cluster.config.services.wireguard.otherNodes.mesh node) [
(map (peer: /*python*/ ''
${node}.succeed("ping -c3 ${cluster.config.hostLinks.${peer}.mesh.extra.meshIp}")
''))
(lib.concatStringsSep "\n ")
]}
''))
(lib.concatStringsSep "\n")
]}
'';
}