From 32ebdc6da26dee42b518f51690742f83f687999a Mon Sep 17 00:00:00 2001 From: Andrew Noyes Date: Wed, 22 Dec 2021 13:42:20 -0800 Subject: [PATCH] Log status json if cluster is unavailable in fdbcli tests --- bindings/python/tests/fdbcli_tests.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/bindings/python/tests/fdbcli_tests.py b/bindings/python/tests/fdbcli_tests.py index 9f8eb84a50..5bb51718c4 100755 --- a/bindings/python/tests/fdbcli_tests.py +++ b/bindings/python/tests/fdbcli_tests.py @@ -503,6 +503,18 @@ def profile(logger): assert run_fdbcli_command('profile', 'client', 'get') == default_profile_client_get_output +@enable_logging() +def test_available(logger): + duration = 0 # seconds we already wait + while not get_value_from_status_json(False, 'client', 'database_status', 'available') and duration < 10: + logger.debug("Sleep for 1 second to wait cluster recovery") + time.sleep(1) + duration += 1 + if duration >= 10: + logger.debug(run_fdbcli_command('status', 'json')) + assert False + + @enable_logging() def triggerddteaminfolog(logger): # this command is straightforward and only has one code path @@ -538,6 +550,7 @@ if __name__ == '__main__': command_template = [args.build_dir + '/bin/fdbcli', '-C', args.cluster_file, '--exec'] # tests for fdbcli commands # assertions will fail if fdbcli does not work as expected + test_available() if args.process_number == 1: # TODO: disable for now, the change can cause the database unavailable # advanceversion()