diff --git a/nixos/tests/consul.nix b/nixos/tests/consul.nix index 6600dae4770..785963d1a7c 100644 --- a/nixos/tests/consul.nix +++ b/nixos/tests/consul.nix @@ -66,6 +66,7 @@ let services.consul = let thisConsensusServerHost = builtins.elemAt allConsensusServerHosts index; + numConsensusServers = builtins.length allConsensusServerHosts; in assert builtins.elem thisConsensusServerHost allConsensusServerHosts; { @@ -73,12 +74,12 @@ let inherit webUi; extraConfig = defaultExtraConfig // { server = true; - bootstrap_expect = builtins.length allConsensusServerHosts; + bootstrap_expect = numConsensusServers; retry_join = # If there's only 1 node in the network, we allow self-join; # otherwise, the node must not try to join itself, and join only the other servers. # See https://github.com/hashicorp/consul/issues/2868 - if builtins.length allConsensusServerHosts == 1 + if numConsensusServers == 1 then allConsensusServerHosts else builtins.filter (h: h != thisConsensusServerHost) allConsensusServerHosts; bind_addr = ip;