Skip to content

Commit 898567b

Browse files
committed
WIP
1 parent 579545a commit 898567b

File tree

3 files changed

+71
-58
lines changed

3 files changed

+71
-58
lines changed

release_tester/arangodb/starter/deployments/cluster.py

+61-58
Original file line numberDiff line numberDiff line change
@@ -532,64 +532,67 @@ def generate_keyfile(self, keyfile):
532532
@step
533533
def test_hotbackup_impl(self):
534534
""" test hotbackup feature: Cluster """
535-
# step 1: create a backup
536-
self.create_backup_and_upload("thy_name_is_" + self.name)
537-
backup_from_step_1 = self.uploaded_backups[-1]
538-
539-
# step 2: create non-backup data
540-
self.create_non_backup_data()
541-
self.tcp_ping_all_nodes()
542-
543-
# step 3: add new db server
544-
new_starter = self.get_not_running_starters()[0]
545-
self.run_starter_and_wait(new_starter)
546-
547-
# step 4: create a backup
548-
self.create_backup_and_upload("thy_name_is_" + self.name + "_+1_server")
549-
backup_from_step_4 = self.uploaded_backups[-1]
550-
551-
# step 5: remove old db server
552-
terminate_instance = None
553-
if not self.starter_instances[1].have_this_instance(self.agency.get_leader()):
554-
terminate_instance = self.starter_instances[1]
555-
else:
556-
terminate_instance = self.starter_instances[2]
557-
terminate_instance.stop_dbserver()
558-
559-
# step 6: create another backup
560-
self.create_backup_and_upload("thy_name_is_" + self.name + "_+1_server_-1server")
561-
562-
# step 7: download and restore backup from step 1
563-
self.download_backup(backup_from_step_1)
564-
self.validate_local_backup(backup_from_step_1)
565-
backups = self.list_backup()
566-
if backups[-1] != backup_from_step_1:
567-
raise Exception("downloaded backup has different name? " + str(backups))
568-
self.restore_backup(backup_from_step_1)
569-
self.tcp_ping_all_nodes()
570-
571-
# step 8: check data
572-
self.check_data_impl()
573-
if not self.check_non_backup_data():
574-
raise Exception("data created after backup is still there??")
575-
576-
# step 9: add new db server
577-
new_starter2 = self.get_not_running_starters()[0]
578-
self.run_starter_and_wait(new_starter2)
579-
580-
# step 10: download and restore backup from step 4
581-
self.download_backup(backup_from_step_4)
582-
self.validate_local_backup(backup_from_step_4)
583-
backups = self.list_backup()
584-
if backups[-1] != backup_from_step_4:
585-
raise Exception("downloaded backup has different name? " + str(backups))
586-
self.restore_backup(backup_from_step_4)
587-
self.tcp_ping_all_nodes()
588-
589-
# step 11: check data
590-
self.check_data_impl()
591-
if not self.check_non_backup_data():
592-
raise Exception("data created after backup is still there??")
535+
with step("step 1: create a backup"):
536+
self.create_backup_and_upload("thy_name_is_" + self.name)
537+
backup_from_step_1 = self.uploaded_backups[-1]
538+
539+
with step("step 2: create non-backup data"):
540+
self.create_non_backup_data()
541+
self.tcp_ping_all_nodes()
542+
543+
with step("step 3: add new db server"):
544+
new_starter = self.get_not_running_starters()[0]
545+
self.run_starter_and_wait(new_starter)
546+
self.backup_instance_count += 1
547+
548+
with step("step 4: create a backup"):
549+
self.create_backup_and_upload("thy_name_is_" + self.name + "_plus1_server")
550+
backup_from_step_4 = self.uploaded_backups[-1]
551+
552+
with step("step 5: remove old db server"):
553+
if not self.starter_instances[1].have_this_instance(self.agency.get_leader()):
554+
terminate_instance = self.starter_instances[1]
555+
else:
556+
terminate_instance = self.starter_instances[2]
557+
terminated_dbserver_uuid = terminate_instance.get_dbserver().get_uuid()
558+
terminate_instance.stop_dbserver()
559+
self.remove_server_from_agency(terminated_dbserver_uuid)
560+
self.backup_instance_count -= 1
561+
562+
with step("step 6: create another backup"):
563+
self.create_backup_and_upload("thy_name_is_" + self.name + "_plus1_server_minus1_server")
564+
565+
with step("step 7: download and restore backup from step 1"):
566+
self.download_backup(backup_from_step_1)
567+
self.validate_local_backup(backup_from_step_1)
568+
backups = self.list_backup()
569+
if backups[-1] != backup_from_step_1:
570+
raise Exception("downloaded backup has different name? " + str(backups))
571+
self.restore_backup(backup_from_step_1)
572+
self.tcp_ping_all_nodes()
573+
574+
with step("step 8: check data"):
575+
self.check_data_impl()
576+
if not self.check_non_backup_data():
577+
raise Exception("data created after backup is still there??")
578+
579+
with step("step 9: add new db server"):
580+
new_starter2 = self.get_not_running_starters()[0]
581+
self.run_starter_and_wait(new_starter2)
582+
583+
with step("step 10: download and restore backup from step 4"):
584+
self.download_backup(backup_from_step_4)
585+
self.validate_local_backup(backup_from_step_4)
586+
backups = self.list_backup()
587+
if backups[-1] != backup_from_step_4:
588+
raise Exception("downloaded backup has different name? " + str(backups))
589+
self.restore_backup(backup_from_step_4)
590+
self.tcp_ping_all_nodes()
591+
592+
with step("step 11: check data"):
593+
self.check_data_impl()
594+
if not self.check_non_backup_data():
595+
raise Exception("data created after backup is still there??")
593596

594597
@staticmethod
595598
def run_starter_and_wait(starter):

release_tester/arangodb/starter/deployments/runner.py

+1
Original file line numberDiff line numberDiff line change
@@ -895,6 +895,7 @@ def upload_backup(self, name, timeout=1200):
895895
hb_id = starter.hb_instance.upload(name, starter.hb_config, "12345")
896896
starter.hb_instance.upload_status(name, hb_id, self.backup_instance_count, timeout=timeout)
897897
self.uploaded_backups.append(name)
898+
return
898899
raise Exception("no frontend found.")
899900

900901
@step

release_tester/arangodb/starter/manager.py

+9
Original file line numberDiff line numberDiff line change
@@ -1280,6 +1280,15 @@ def count_occurances_in_starter_log(self, substring: str):
12801280
number_of_occurances = self.get_log_file().count(substring)
12811281
return number_of_occurances
12821282

1283+
def stop_dbserver(self):
1284+
"""stop db server managed by this starter"""
1285+
dbserver = self.get_dbserver()
1286+
self.kill_instance()
1287+
dbserver.terminate_instance()
1288+
self.all_instances.remove(dbserver)
1289+
self.moreopts.append("--cluster.start-dbserver=false")
1290+
self.run_starter()
1291+
12831292

12841293
class StarterNonManager(StarterManager):
12851294
"""this class is a dummy starter manager to work with similar interface"""

0 commit comments

Comments
 (0)