diff --git a/cluster/services/consul/default.nix b/cluster/services/consul/default.nix index d7855b6..ee4e374 100644 --- a/cluster/services/consul/default.nix +++ b/cluster/services/consul/default.nix @@ -22,6 +22,11 @@ in ]; ready = ./ready.nix; }; + simulacrum = { + enable = true; + deps = [ "wireguard" ]; + settings = ./test.nix; + }; }; dns.records."consul-remote.internal".consulService = "consul-remote"; diff --git a/cluster/services/consul/test.nix b/cluster/services/consul/test.nix new file mode 100644 index 0000000..f4aa2eb --- /dev/null +++ b/cluster/services/consul/test.nix @@ -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 + ''; +} diff --git a/modules/part.nix b/modules/part.nix index 3a6afcb..1ce9db6 100644 --- a/modules/part.nix +++ b/modules/part.nix @@ -29,7 +29,6 @@ in reflection = ./reflection; shell-config = ./shell-config; ssh = ./ssh; - system-info = ./system-info; system-recovery = ./system-recovery; systemd-extras = ./systemd-extras; tested = ./tested; @@ -56,7 +55,6 @@ in motd networking nix-config-server - system-info system-recovery tested ]; diff --git a/modules/system-info/default.nix b/modules/system-info/default.nix deleted file mode 100644 index af865d4..0000000 --- a/modules/system-info/default.nix +++ /dev/null @@ -1,5 +0,0 @@ -{ depot, ... }: - -{ - system.configurationRevision = depot.rev or null; -}