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 03:05:54 +0200
committerNiklas Hambüchen <mail@nh2.me>2020-06-18 03:05:54 +0200
commitbcdac2e2fdfe5144a7752f85489d37532a1b332e (patch)
tree93ba022b23fa9ae2707dbfdfd563f4a251c803df /nixos/tests/consul.nix
parent811bcbe74a7838244f88462a21828d08bf7cc4b8 (diff)
downloadnixpkgs-bcdac2e2fdfe5144a7752f85489d37532a1b332e.tar
nixpkgs-bcdac2e2fdfe5144a7752f85489d37532a1b332e.tar.gz
nixpkgs-bcdac2e2fdfe5144a7752f85489d37532a1b332e.tar.bz2
nixpkgs-bcdac2e2fdfe5144a7752f85489d37532a1b332e.tar.lz
nixpkgs-bcdac2e2fdfe5144a7752f85489d37532a1b332e.tar.xz
nixpkgs-bcdac2e2fdfe5144a7752f85489d37532a1b332e.tar.zst
nixpkgs-bcdac2e2fdfe5144a7752f85489d37532a1b332e.zip
consul.passthru.tests: Refactor: Extract function
Diffstat (limited to 'nixos/tests/consul.nix')
-rw-r--r--nixos/tests/consul.nix12
1 files changed, 10 insertions, 2 deletions
diff --git a/nixos/tests/consul.nix b/nixos/tests/consul.nix
index c6f2ac8b2f6..3e26dcad2ca 100644
--- a/nixos/tests/consul.nix
+++ b/nixos/tests/consul.nix
@@ -128,10 +128,18 @@ in {
             )
 
 
+    def wait_for_all_machines_alive():
+        """
+        Note that Serf-"alive" does not mean "Raft"-healthy;
+        see `wait_for_healthy_servers()` for that instead.
+        """
+        for m in machines:
+            m.wait_until_succeeds("[ $(consul members | grep -o alive | wc -l) == 5 ]")
+
+
     wait_for_healthy_servers()
     # Also wait for clients to be alive.
-    for m in machines:
-        m.wait_until_succeeds("[ $(consul members | grep -o alive | wc -l) == 5 ]")
+    wait_for_all_machines_alive()
 
     client1.succeed("consul kv put testkey 42")
     client2.succeed("[ $(consul kv get testkey) == 42 ]")