cluster/services/wireguard: test in simulacrum
This commit is contained in:
parent
e2ebdd097e
commit
a10f8c18ee
2 changed files with 30 additions and 0 deletions
|
@ -93,5 +93,9 @@ in
|
|||
nodes = config.services.wireguard.nodes.mesh;
|
||||
shared = false;
|
||||
};
|
||||
simulacrum = {
|
||||
enable = true;
|
||||
settings = ./test.nix;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
26
cluster/services/wireguard/test.nix
Normal file
26
cluster/services/wireguard/test.nix
Normal file
|
@ -0,0 +1,26 @@
|
|||
{ cluster, lib, ... }:
|
||||
|
||||
{
|
||||
testScript = ''
|
||||
start_all()
|
||||
${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")
|
||||
]}
|
||||
'';
|
||||
}
|
Loading…
Reference in a new issue