The Simulacrum: Stage 2 #109

Merged
max merged 2 commits from pr-simulacrum-stage-2 into master 2024-08-14 00:34:12 +03:00
2 changed files with 25 additions and 0 deletions
Showing only changes of commit f097de64c7 - Show all commits

View file

@ -22,6 +22,11 @@ in
]; ];
ready = ./ready.nix; ready = ./ready.nix;
}; };
simulacrum = {
enable = true;
deps = [ "wireguard" ];
settings = ./test.nix;
};
}; };
dns.records."consul-remote.internal".consulService = "consul-remote"; dns.records."consul-remote.internal".consulService = "consul-remote";

View file

@ -0,0 +1,20 @@
{
testScript = ''
import json
start_all()
with subtest("should form cluster"):
nodes = [ n for n in machines if n != nowhere ]
for machine in nodes:
machine.succeed("systemctl start consul-ready.service")
for machine in nodes:
consulConfig = json.loads(machine.succeed("cat /etc/consul.json"))
addr = consulConfig["addresses"]["http"]
port = consulConfig["ports"]["http"]
setEnv = f"CONSUL_HTTP_ADDR={addr}:{port}"
memberList = machine.succeed(f"{setEnv} consul members --status=alive")
for machine2 in nodes:
assert machine2.name in memberList
'';
}