From bcdac2e2fdfe5144a7752f85489d37532a1b332e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20Hamb=C3=BCchen?= Date: Thu, 18 Jun 2020 03:05:54 +0200 Subject: [PATCH] consul.passthru.tests: Refactor: Extract function --- nixos/tests/consul.nix | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/nixos/tests/consul.nix b/nixos/tests/consul.nix index c6f2ac8b2f6c..3e26dcad2cae 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 ]")