diff --git a/release_tester/arangodb/sh.py b/release_tester/arangodb/sh.py index 4c3016f2..48deafe0 100644 --- a/release_tester/arangodb/sh.py +++ b/release_tester/arangodb/sh.py @@ -440,10 +440,24 @@ 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, + log_debug=False, + deadline=900, + progressive_timeout=25 + ): """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: @@ -452,15 +466,22 @@ def clear_test_data(self, testname, args=None, result_line_handler=default_line_ test_filter = [] if self.cfg.test != "": test_filter = ["--test", self.cfg.test] + if self.cfg.skip != "": + test_filter += ["--skip", self.cfg.skip] ret = self.run_script_monitored( cmd=[ "cleaning up test data", self.cfg.test_data_dir.resolve() / "cleardata.js", - ] - + test_filter, - args=args + ["--progress", "true"], - progressive_timeout=5, + ], + args=args + [ + "--progress", "true", + '--testFoxx', 'true' if supports_foxx_tests else 'false', + ] + test_filter, + progressive_timeout=progressive_timeout, result_line_handler=result_line_handler, + verbose=self.cfg.verbose or log_debug, + log_debug=log_debug, + deadline=deadline, ) return ret diff --git a/release_tester/arangodb/starter/deployments/runner.py b/release_tester/arangodb/starter/deployments/runner.py index c5e29e20..22c848ae 100644 --- a/release_tester/arangodb/starter/deployments/runner.py +++ b/release_tester/arangodb/starter/deployments/runner.py @@ -262,6 +262,10 @@ def run(self): self.makedata_instances[0].arangosh.self_test() if self.props.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() @@ -279,6 +283,15 @@ def run(self): self.tcp_ping_all_nodes() self.create_non_backup_data() taken_backups = self.list_backup() + 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) + backup_no = len(taken_backups) - 1 self.upload_backup(taken_backups[backup_no]) self.tcp_ping_all_nodes() @@ -293,6 +306,7 @@ def run(self): backups = self.list_backup() if backups[len(backups) - 1] != self.backup_name: raise Exception("downloaded backup has different name? " + str(backups)) + self.clear_data_impl() self.before_backup() self.restore_backup(backups[len(backups) - 1]) self.tcp_ping_all_nodes() @@ -774,6 +788,47 @@ 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 + deadline = 1800 if self.cfg.is_instrumented else 900 + progressive_timeout = 1000 if self.cfg.is_instrumented else 25 + 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 + for db_name, one_shard, count_offset in self.makedata_databases()[::-1]: + print(db_name, one_shard, count_offset) + try: + starter.arangosh.clear_test_data( + self.name, + starter.supports_foxx_tests, + args=["--countOffset", str(count_offset)], + database_name=db_name, + one_shard=one_shard, + deadline=deadline, + progressive_timeout=progressive_timeout, + ) + except CliExecutionException as exc: + print("cleardata failed!") + print(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, + ) + print("Done cleanup") + 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"""