From 932058e64b9e468d0dbfaed02233b60a03f2d9c6 Mon Sep 17 00:00:00 2001 From: Chaoguang Lin Date: Wed, 14 Jul 2021 22:37:07 +0000 Subject: [PATCH] Add tests for fdbcli commands running against multi-process cluster --- bindings/python/CMakeLists.txt | 9 +++++++ bindings/python/tests/fdbcli_tests.py | 36 ++++++++++++++++++--------- 2 files changed, 33 insertions(+), 12 deletions(-) diff --git a/bindings/python/CMakeLists.txt b/bindings/python/CMakeLists.txt index 0893b08aa8..c9732a1693 100644 --- a/bindings/python/CMakeLists.txt +++ b/bindings/python/CMakeLists.txt @@ -81,5 +81,14 @@ if (NOT WIN32 AND NOT OPEN_FOR_IDE) COMMAND ${CMAKE_SOURCE_DIR}/bindings/python/tests/fdbcli_tests.py ${CMAKE_BINARY_DIR}/bin/fdbcli @CLUSTER_FILE@ + 1 + ) + add_fdbclient_test( + NAME multi_process_fdbcli_tests + PROCESS_NUMBER 5 + COMMAND ${CMAKE_SOURCE_DIR}/bindings/python/tests/fdbcli_tests.py + ${CMAKE_BINARY_DIR}/bin/fdbcli + @CLUSTER_FILE@ + 5 ) endif() diff --git a/bindings/python/tests/fdbcli_tests.py b/bindings/python/tests/fdbcli_tests.py index 71fe5ee6b3..4383171516 100755 --- a/bindings/python/tests/fdbcli_tests.py +++ b/bindings/python/tests/fdbcli_tests.py @@ -332,22 +332,34 @@ def transaction(logger): output7 = run_fdbcli_command('get', 'key') assert output7 == "`key': not found" +@enable_logging(logging.DEBUG) +def coordinator(logger): + output1 = run_fdbcli_command('coordinators') + logger.debug(output1) + output2 = run_fdbcli_command('status', 'details') + logger.debug(output2) if __name__ == '__main__': - # fdbcli_tests.py - assert len(sys.argv) == 3, "Please pass arguments: " + # fdbcli_tests.py + assert len(sys.argv) == 4, "Please pass arguments: " # shell command template command_template = [sys.argv[1], '-C', sys.argv[2], '--exec'] # tests for fdbcli commands # assertions will fail if fdbcli does not work as expected - advanceversion() - cache_range() - consistencycheck() - datadistribution() - kill() - lockAndUnlock() - maintenance() - setclass() - suspend() - transaction() + process_number = int(sys.argv[3]) + if process_number == 1: + advanceversion() + cache_range() + consistencycheck() + datadistribution() + kill() + lockAndUnlock() + maintenance() + setclass() + suspend() + transaction() + else: + assert process_number > 1, "Process number should be positive" + +