From 9e3aee67737f9f04fc9f47bec6a547e37e7b78a0 Mon Sep 17 00:00:00 2001 From: Ben Huddleston Date: Thu, 2 May 2024 14:17:11 +0100 Subject: [PATCH] MB-58691: Overwrite passed cluster with result from testset This allow us to change the cluster variable of a testset and have the modification manifest for the testrunner to correctly tear down the correct cluster. This will be used in a future change to test node remapping which tears down and recreates the original cluster at the start and end of the test respectively. Change-Id: I1ce5b15f03ff3ad9542fb76db4ed57705de97480 Reviewed-on: https://review.couchbase.org/c/ns_server/+/209394 Well-Formed: Build Bot Well-Formed: Restriction Checker Tested-by: Ben Huddleston Reviewed-by: Peter Searby --- cluster_tests/run.py | 6 ++++-- cluster_tests/testlib/testlib.py | 5 ++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/cluster_tests/run.py b/cluster_tests/run.py index bae293a3c..ce51e6906 100755 --- a/cluster_tests/run.py +++ b/cluster_tests/run.py @@ -326,7 +326,8 @@ def main(): start_index) testset_start_ts = time.time_ns() # Run the testsets on the cluster - tests_executed, testset_errors, testset_not_ran, log_collection_time = \ + tests_executed, testset_errors, testset_not_ran, log_collection_time,\ + cluster = \ run_testsets(cluster, testsets, total_num, seed=seed, stop_after_first_error=stop_after_first_error, @@ -611,6 +612,7 @@ def skip_this_testset(error): executed += res[0] testset_errors = res[1] not_ran += res[2] + cluster = res[3] # We use a catch-all here because if we hit any errors while running # a testset, but not in a test, then it is likely an issue with the # cluster, so we should keep running more tests @@ -668,7 +670,7 @@ def skip_this_testset(error): print(f"Collected logs for {node.url}: {path}") log_collection_time += (time.time_ns() - collect_start_time) - return executed, errors, not_ran, log_collection_time + return executed, errors, not_ran, log_collection_time, cluster if __name__ == '__main__': diff --git a/cluster_tests/testlib/testlib.py b/cluster_tests/testlib/testlib.py index f660645bb..f2100f86a 100644 --- a/cluster_tests/testlib/testlib.py +++ b/cluster_tests/testlib/testlib.py @@ -123,6 +123,9 @@ def run_testset(testset, cluster, total_testsets_num, seed=None, _, err = safe_test_function_call(testset_instance, test, [], testiter, verbose=True, seed=test_seed) + + cluster = testset_instance.cluster + if err is not None: errors.append(err) @@ -154,7 +157,7 @@ def run_testset(testset, cluster, total_testsets_num, seed=None, if err is not None: errors.append(err) - return executed, errors, not_ran + return executed, errors, not_ran, cluster def test_name(testset, testname, testiter):