From aebaccdc48103dc640c20839a47240f35d4e426b Mon Sep 17 00:00:00 2001 From: Wilfried Goesgens Date: Wed, 15 May 2024 16:42:31 +0200 Subject: [PATCH 1/3] try to start running cleanup so we can test restore to flushed systems --- release_tester/arangodb/sh.py | 22 ++++++-- .../arangodb/starter/deployments/runner.py | 51 +++++++++++++++++++ 2 files changed, 69 insertions(+), 4 deletions(-) diff --git a/release_tester/arangodb/sh.py b/release_tester/arangodb/sh.py index 0d20daaed..b07440692 100644 --- a/release_tester/arangodb/sh.py +++ b/release_tester/arangodb/sh.py @@ -390,10 +390,20 @@ def check_test_data( return ret @step - def clear_test_data(self, testname, args=None, result_line_handler=default_line_result): + def clear_test_data( + self, + testname, + supports_foxx_tests, + args=None, + one_shard: bool = False, + database_name: str = "_system", + result_line_handler=default_line_result): """flush the testdata from the instance again""" if args is None: args = [] + args = [database_name] + args + if one_shard: + args += ["--singleShard", "true"] if testname: logging.info("removing test data for {0}".format(testname)) else: @@ -406,9 +416,13 @@ def clear_test_data(self, testname, args=None, result_line_handler=default_line_ cmd=[ "cleaning up test data", self.cfg.test_data_dir.resolve() / "cleardata.js", - ] - + test_filter, - args=args + ["--progress", "true"], + ], + args=args + [ + '--progress', 'true', + '--oldVersion', self.old_version, + '--testFoxx', 'true' if supports_foxx_tests else 'false', + '--passvoid', self.cfg.passvoid + ] + test_filter, progressive_timeout=5, result_line_handler=result_line_handler, ) diff --git a/release_tester/arangodb/starter/deployments/runner.py b/release_tester/arangodb/starter/deployments/runner.py index cfff3fda4..7a1ad3419 100644 --- a/release_tester/arangodb/starter/deployments/runner.py +++ b/release_tester/arangodb/starter/deployments/runner.py @@ -352,6 +352,7 @@ def run(self): bound = 1 if is_single_test else versions_count - 1 for i in range(0, bound): + print('yyyyyyyyyyyyyyyyyyyyyyy') self.old_installer = self.installers[i][1] if i == 0: # if i != 0, it means that self.cfg was already updated after chain-upgrade @@ -385,6 +386,10 @@ def run(self): self.finish_setup() if self.create_oneshard_db: self.custom_databases.append(["system_oneshard_makedata", True, 1]) + if self.hot_backup: + self.progress(False, "TESTING empty HOTBACKUP") + self.empty_backup_name = self.create_backup("empty_" + self.name) + self.make_data() self.after_makedata_check() self.check_data_impl() @@ -425,6 +430,15 @@ def run(self): self.check_data_impl() if not self.check_non_backup_data(): raise Exception("data created after backup is still there??") + self.clear_data_impl() + print('zzzzzzzzzzzzzzzzzzzzzzzzzz') + self.restore_backup(backups[len(backups) - 1]) + self.tcp_ping_all_nodes() + self.after_backup() + time.sleep(20) # TODO fix + self.check_data_impl() + if not self.check_non_backup_data(): + raise Exception("data created after backup is still there??") if self.new_installer: if self.hot_backup: @@ -891,6 +905,42 @@ def check_data_impl(self): if not frontend_found: raise Exception("no frontend found.") + @step + def clear_data_impl(self): + """clear the data on the installation""" + frontend_found = False + if self.has_makedata_data: + print(self.makedata_instances) + for starter in self.makedata_instances: + if not starter.is_leader: + continue + assert starter.arangosh, "check: this starter doesn't have an arangosh!" + frontend_found = True + arangosh = starter.arangosh + for db_name, one_shard, count_offset in self.makedata_databases(): + try: + print(count_offset) + starter.arangosh.clear_test_data( + self.name, + starter.supports_foxx_tests, + args=["--countOffset", str(count_offset)], + database_name=db_name, + one_shard=one_shard, + ) + break + except CliExecutionException as exc: + if not self.cfg.verbose: + print(exc.execution_result[1]) + self.ask_continue_or_exit( + f"check_data has failed for {self.name} in database {db_name} with {exc}", + exc.execution_result[1], + False, + exc, + ) + return + if not frontend_found: + raise Exception("no frontend found.") + @step def create_non_backup_data(self): """create data to be zapped by the restore operation""" @@ -1040,6 +1090,7 @@ def search_for_warnings(self, print_lines=True): @step def zip_test_dir(self): """💾 store the test directory for later analysis""" + return #TODO build_number = os.environ.get("BUILD_NUMBER") if build_number: build_number = "_" + build_number From 07107837dbb065b3ca13a82831d9529112398727 Mon Sep 17 00:00:00 2001 From: Wilfried Goesgens Date: Fri, 17 May 2024 16:15:33 +0200 Subject: [PATCH 2/3] fix cleanup invocation --- release_tester/arangodb/starter/deployments/runner.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/release_tester/arangodb/starter/deployments/runner.py b/release_tester/arangodb/starter/deployments/runner.py index 7a1ad3419..47fbedf32 100644 --- a/release_tester/arangodb/starter/deployments/runner.py +++ b/release_tester/arangodb/starter/deployments/runner.py @@ -917,9 +917,9 @@ def clear_data_impl(self): assert starter.arangosh, "check: this starter doesn't have an arangosh!" frontend_found = True arangosh = starter.arangosh - for db_name, one_shard, count_offset in self.makedata_databases(): + for db_name, one_shard, count_offset in self.makedata_databases()[::-1]: + print(db_name, one_shard, count_offset) try: - print(count_offset) starter.arangosh.clear_test_data( self.name, starter.supports_foxx_tests, @@ -927,8 +927,9 @@ def clear_data_impl(self): database_name=db_name, one_shard=one_shard, ) - break except CliExecutionException as exc: + print("cleardata failed!") + print(exc) if not self.cfg.verbose: print(exc.execution_result[1]) self.ask_continue_or_exit( @@ -937,7 +938,8 @@ def clear_data_impl(self): False, exc, ) - return + print("Done cleanup") + return if not frontend_found: raise Exception("no frontend found.") From 1e3bdb6ce55dd66e3ab939522b594d7e3c163f9f Mon Sep 17 00:00:00 2001 From: Wilfried Goesgens Date: Tue, 21 May 2024 14:40:37 +0200 Subject: [PATCH 3/3] choose proper backup --- .../arangodb/starter/deployments/runner.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/release_tester/arangodb/starter/deployments/runner.py b/release_tester/arangodb/starter/deployments/runner.py index 47fbedf32..abe4e5aac 100644 --- a/release_tester/arangodb/starter/deployments/runner.py +++ b/release_tester/arangodb/starter/deployments/runner.py @@ -408,10 +408,16 @@ def run(self): self.tcp_ping_all_nodes() self.create_non_backup_data() taken_backups = self.list_backup() - backup_no = len(taken_backups) - 1 - self.upload_backup(taken_backups[backup_no]) + work_backup = "" + for one_backup in taken_backups: + print(one_backup) + if one_backup.startswith(self.backup_name): + work_backup = one_backup + if work_backup == "": + raise Exception("backup {self.backup_name} not found in {taken_backups}") + self.upload_backup(work_backup) self.tcp_ping_all_nodes() - self.delete_backup(taken_backups[backup_no]) + self.delete_backup(work_backup) self.tcp_ping_all_nodes() backups = self.list_backup() if len(backups) != len(taken_backups) - 1: