Fix HA log compaction test
Summary: The test now checks if the cluster is alive at the end of the test. Reviewers: mferencevic Reviewed By: mferencevic Subscribers: pullbot Differential Revision: https://phabricator.memgraph.io/D2343
This commit is contained in:
parent
1dccf02e1b
commit
58be850d5c
@ -76,6 +76,13 @@ class HaTestBase:
|
||||
self._wait_for_server(7687 + worker_id)
|
||||
|
||||
|
||||
def is_worker_alive(self, worker_id):
|
||||
assert worker_id >= 0 and worker_id < self.cluster_size, \
|
||||
"Invalid worker ID {}".format(worker_id)
|
||||
return self.workers[worker_id] is None or \
|
||||
self.workers[worker_id].poll() is None
|
||||
|
||||
|
||||
def execute(self):
|
||||
raise NotImplementedError()
|
||||
|
||||
|
@ -45,7 +45,7 @@ class HaLogCompactionTest(HaTestBase):
|
||||
snapshots = os.listdir(dur)
|
||||
|
||||
assert len(snapshots) == 1, \
|
||||
"More than one snapshot on worker {}!".format(worker_id)
|
||||
"More than one snapshot on worker {}!".format(worker_id + 1)
|
||||
return os.path.join(dur, snapshots[0])
|
||||
|
||||
|
||||
@ -55,7 +55,8 @@ class HaLogCompactionTest(HaTestBase):
|
||||
self.start_worker(worker_id)
|
||||
|
||||
time.sleep(5)
|
||||
self.execute_step("CREATE (:Node)\n" * 128)
|
||||
assert self.execute_step("CREATE (:Node)\n" * 128) == 0, \
|
||||
"Error while executing create query"
|
||||
|
||||
self.start_worker(0)
|
||||
|
||||
@ -69,6 +70,11 @@ class HaLogCompactionTest(HaTestBase):
|
||||
success = True
|
||||
break
|
||||
|
||||
# Check if the cluster is alive
|
||||
for worker_id in range(self.cluster_size):
|
||||
assert self.is_worker_alive(worker_id), \
|
||||
"Worker {} died prematurely".format(worker_id + 1)
|
||||
|
||||
assert success, "Snapshot didn't transfer successfully"
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user