2024-07-23 03:47:01 +03:00
|
|
|
{
|
|
|
|
testScript = ''
|
|
|
|
import json
|
|
|
|
|
|
|
|
start_all()
|
|
|
|
|
|
|
|
with subtest("should form cluster"):
|
2024-08-13 23:07:28 +03:00
|
|
|
nodes = [ n for n in machines if n != nowhere ]
|
|
|
|
for machine in nodes:
|
2024-07-23 03:47:01 +03:00
|
|
|
machine.succeed("systemctl start consul-ready.service")
|
2024-08-13 23:07:28 +03:00
|
|
|
for machine in nodes:
|
2024-07-23 03:47:01 +03:00
|
|
|
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 machines:
|
|
|
|
assert machine2.name in memberList
|
|
|
|
'';
|
|
|
|
}
|