about summary refs log tree commit diff
path: root/nixos/tests/consul.nix
diff options
context:
space:
mode:
authorNiklas Hambüchen <mail@nh2.me>2020-06-18 01:45:11 +0200
committerNiklas Hambüchen <mail@nh2.me>2020-06-18 02:22:23 +0200
commitf795df26cfd0cb746be89f9e004a25d85e0d8465 (patch)
tree75ce5cb6d7d25b94eeeabb80192e6fdeec651e6b /nixos/tests/consul.nix
parent720128ce7e8e39597895109b7687b511510048ca (diff)
consul.passthru.tests: Refactor: Extract variable
Diffstat (limited to 'nixos/tests/consul.nix')
-rw-r--r--nixos/tests/consul.nix5
1 files changed, 3 insertions, 2 deletions
diff --git a/nixos/tests/consul.nix b/nixos/tests/consul.nix
index 6600dae4770b2..785963d1a7cc4 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;