diff options
author | Niklas Hambüchen <mail@nh2.me> | 2020-06-18 01:49:24 +0200 |
---|---|---|
committer | Niklas Hambüchen <mail@nh2.me> | 2020-06-18 02:22:29 +0200 |
commit | 25d665634a1bd38515320beabf85a6e23545bac7 (patch) | |
tree | 57cc5d401ed48317bb137c523cd0c933132fcca4 /nixos/tests/consul.nix | |
parent | 777d1c0944e931bf5bb3538982c144b8916d1b97 (diff) |
consul.passthru.tests: Refactor: Extract variable
Diffstat (limited to 'nixos/tests/consul.nix')
-rw-r--r-- | nixos/tests/consul.nix | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/nixos/tests/consul.nix b/nixos/tests/consul.nix index a5188d1283041..eb7dd45923fc4 100644 --- a/nixos/tests/consul.nix +++ b/nixos/tests/consul.nix @@ -55,6 +55,7 @@ let server = index: { pkgs, ... }: let + numConsensusServers = builtins.length allConsensusServerHosts; thisConsensusServerHost = builtins.elemAt allConsensusServerHosts index; ip = thisConsensusServerHost; # since we already use IPs to identify servers in @@ -71,12 +72,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; |