Skip to content

Commit 6bbe51f

Browse files
committed
test(robot): refine test case Power Off Replica Node Should Not Rebuild New Replica On Same Node with retry mechanism
Signed-off-by: Yang Chiu <yang.chiu@suse.com>
1 parent 62fb430 commit 6bbe51f

2 files changed

Lines changed: 9 additions & 5 deletions

File tree

e2e/libs/keywords/volume_keywords.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -435,10 +435,14 @@ def check_volume_replica_names_recorded(self, volume_name):
435435
replica_names_str = self.volume.get_annotation_value(volume_name, ANNOT_REPLICA_NAMES)
436436
expected_replica_names = sorted(replica_names_str.split(","))
437437

438-
replica_list = self.replica.get(volume_name, node_name="")
439-
actual_replica_names = [replica['metadata']['name'] for replica in replica_list]
440-
actual_replica_names = sorted(actual_replica_names)
441-
438+
actual_replica_names = []
439+
for i in range(self.retry_count):
440+
replica_list = self.replica.get(volume_name, node_name="")
441+
actual_replica_names = sorted([replica['metadata']['name'] for replica in replica_list])
442+
logging(f"Checking volume {volume_name} replica names recorded ... ({i})")
443+
if actual_replica_names == expected_replica_names:
444+
return
445+
time.sleep(self.retry_interval)
442446
assert actual_replica_names == expected_replica_names, \
443447
f"The volume should reuse the failed replica to rebuild instead of creating a new one.\n" \
444448
f"Volume {volume_name} replica names mismatched:\n" \

e2e/tests/negative/test_dr_volume.robot

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ Test DR Volume Live Upgrade And Rebuild
157157

158158
${LONGHORN_STABLE_VERSION}= Get Environment Variable LONGHORN_STABLE_VERSION default=''
159159
IF '${LONGHORN_STABLE_VERSION}' == ''
160-
Fail Environment variable LONGHORN_STABLE_VERSION is not set
160+
Skip Environment variable LONGHORN_STABLE_VERSION is not set
161161
END
162162

163163
# Precondition: Set up environment and install Longhorn

0 commit comments

Comments
 (0)