diff --git a/manager/integration/tests/common.py b/manager/integration/tests/common.py index 439129e0a..daa02445a 100644 --- a/manager/integration/tests/common.py +++ b/manager/integration/tests/common.py @@ -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 @@ -2551,7 +2552,8 @@ 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 @@ -2559,9 +2561,12 @@ def wait_for_replica_scheduled(client, volume_name, to_nodes, 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 diff --git a/manager/integration/tests/test_basic.py b/manager/integration/tests/test_basic.py index aa531040f..77851b050 100644 --- a/manager/integration/tests/test_basic.py +++ b/manager/integration/tests/test_basic.py @@ -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)