Skip to content

Commit e66cc66

Browse files
committed
try to start running cleanup so we can test restore to flushed systems
1 parent f8e15ba commit e66cc66

File tree

2 files changed

+69
-4
lines changed

2 files changed

+69
-4
lines changed

release_tester/arangodb/sh.py

+18-4
Original file line numberDiff line numberDiff line change
@@ -390,10 +390,20 @@ def check_test_data(
390390
return ret
391391

392392
@step
393-
def clear_test_data(self, testname, args=None, result_line_handler=default_line_result):
393+
def clear_test_data(
394+
self,
395+
testname,
396+
supports_foxx_tests,
397+
args=None,
398+
one_shard: bool = False,
399+
database_name: str = "_system",
400+
result_line_handler=default_line_result):
394401
"""flush the testdata from the instance again"""
395402
if args is None:
396403
args = []
404+
args = [database_name] + args
405+
if one_shard:
406+
args += ["--singleShard", "true"]
397407
if testname:
398408
logging.info("removing test data for {0}".format(testname))
399409
else:
@@ -406,9 +416,13 @@ def clear_test_data(self, testname, args=None, result_line_handler=default_line_
406416
cmd=[
407417
"cleaning up test data",
408418
self.cfg.test_data_dir.resolve() / "cleardata.js",
409-
]
410-
+ test_filter,
411-
args=args + ["--progress", "true"],
419+
],
420+
args=args + [
421+
'--progress', 'true',
422+
'--oldVersion', self.old_version,
423+
'--testFoxx', 'true' if supports_foxx_tests else 'false',
424+
'--passvoid', self.cfg.passvoid
425+
] + test_filter,
412426
progressive_timeout=5,
413427
result_line_handler=result_line_handler,
414428
)

release_tester/arangodb/starter/deployments/runner.py

+51
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,7 @@ def run(self):
352352
bound = 1 if is_single_test else versions_count - 1
353353

354354
for i in range(0, bound):
355+
print('yyyyyyyyyyyyyyyyyyyyyyy')
355356
self.old_installer = self.installers[i][1]
356357
if i == 0:
357358
# if i != 0, it means that self.cfg was already updated after chain-upgrade
@@ -385,6 +386,10 @@ def run(self):
385386
self.finish_setup()
386387
if self.create_oneshard_db:
387388
self.custom_databases.append(["system_oneshard_makedata", True, 1])
389+
if self.hot_backup:
390+
self.progress(False, "TESTING empty HOTBACKUP")
391+
self.empty_backup_name = self.create_backup("empty_" + self.name)
392+
388393
self.make_data()
389394
self.after_makedata_check()
390395
self.check_data_impl()
@@ -425,6 +430,15 @@ def run(self):
425430
self.check_data_impl()
426431
if not self.check_non_backup_data():
427432
raise Exception("data created after backup is still there??")
433+
self.clear_data_impl()
434+
print('zzzzzzzzzzzzzzzzzzzzzzzzzz')
435+
self.restore_backup(backups[len(backups) - 1])
436+
self.tcp_ping_all_nodes()
437+
self.after_backup()
438+
time.sleep(20) # TODO fix
439+
self.check_data_impl()
440+
if not self.check_non_backup_data():
441+
raise Exception("data created after backup is still there??")
428442

429443
if self.new_installer:
430444
if self.hot_backup:
@@ -891,6 +905,42 @@ def check_data_impl(self):
891905
if not frontend_found:
892906
raise Exception("no frontend found.")
893907

908+
@step
909+
def clear_data_impl(self):
910+
"""clear the data on the installation"""
911+
frontend_found = False
912+
if self.has_makedata_data:
913+
print(self.makedata_instances)
914+
for starter in self.makedata_instances:
915+
if not starter.is_leader:
916+
continue
917+
assert starter.arangosh, "check: this starter doesn't have an arangosh!"
918+
frontend_found = True
919+
arangosh = starter.arangosh
920+
for db_name, one_shard, count_offset in self.makedata_databases():
921+
try:
922+
print(count_offset)
923+
starter.arangosh.clear_test_data(
924+
self.name,
925+
starter.supports_foxx_tests,
926+
args=["--countOffset", str(count_offset)],
927+
database_name=db_name,
928+
one_shard=one_shard,
929+
)
930+
break
931+
except CliExecutionException as exc:
932+
if not self.cfg.verbose:
933+
print(exc.execution_result[1])
934+
self.ask_continue_or_exit(
935+
f"check_data has failed for {self.name} in database {db_name} with {exc}",
936+
exc.execution_result[1],
937+
False,
938+
exc,
939+
)
940+
return
941+
if not frontend_found:
942+
raise Exception("no frontend found.")
943+
894944
@step
895945
def create_non_backup_data(self):
896946
"""create data to be zapped by the restore operation"""
@@ -1040,6 +1090,7 @@ def search_for_warnings(self, print_lines=True):
10401090
@step
10411091
def zip_test_dir(self):
10421092
"""💾 store the test directory for later analysis"""
1093+
return #TODO
10431094
build_number = os.environ.get("BUILD_NUMBER")
10441095
if build_number:
10451096
build_number = "_" + build_number

0 commit comments

Comments
 (0)