Skip to content

Commit

Permalink
test(integration): skip failed replica validation in test_allow_volum…
Browse files Browse the repository at this point in the history
…e_creation_with_degraded_availability_restore

longhorn/longhorn-9852

Signed-off-by: Chin-Ya Huang <[email protected]>
  • Loading branch information
c3y1huang committed Dec 3, 2024
1 parent c626c41 commit 7961c1d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
17 changes: 11 additions & 6 deletions manager/integration/tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -2536,8 +2536,9 @@ def wait_for_replica_scheduled(client, volume_name, to_nodes,
assert volume.robustness == VOLUME_ROBUSTNESS_HEALTHY

scheduled = 0
unexpect_fail = expect_fail
expect_nodes = [n for n in to_nodes]
unexpect_fail = max(0, expect_fail)

expect_nodes = set(to_nodes)
for r in volume.replicas:
try:
assert r.hostId in expect_nodes
Expand All @@ -2551,17 +2552,21 @@ def wait_for_replica_scheduled(client, volume_name, to_nodes,

scheduled += 1
except AssertionError:
unexpect_fail -= 1
if expect_fail >= 0:
unexpect_fail -= 1

if scheduled == expect_success and unexpect_fail == 0:
break

time.sleep(RETRY_INTERVAL)

assert scheduled == expect_success, f" Volume = {volume}"
assert unexpect_fail == 0, f" Volume = {volume}"
assert len(volume.replicas) == expect_success + expect_fail, \
f" Volume = {volume}"
assert unexpect_fail == 0, f"Got {unexpect_fail} unexpected fail"

if expect_fail >= 0:
assert len(volume.replicas) == expect_success + expect_fail, \
f" Volume = {volume}"

return volume


Expand Down
2 changes: 1 addition & 1 deletion manager/integration/tests/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -3791,7 +3791,7 @@ def test_allow_volume_creation_with_degraded_availability_restore(set_random_bac
to_nodes=[node1.name,
node2.name],
expect_success=2,
expect_fail=0,
expect_fail=-1,
chk_vol_healthy=False,
chk_replica_running=False)

Expand Down

0 comments on commit 7961c1d

Please sign in to comment.