Skip to content

Commit 2349fa2

Browse files
committed
test: work around for flaky longhorn python client list_volume function
Signed-off-by: Yang Chiu <yang.chiu@suse.com>
1 parent b32e70e commit 2349fa2

1 file changed

Lines changed: 10 additions & 7 deletions

File tree

manager/integration/tests/common.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2149,14 +2149,17 @@ def wait_for_volume_status(client, name, key, value,
21492149

21502150
def wait_for_volume_delete(client, name):
21512151
for i in range(RETRY_COUNTS):
2152-
volumes = client.list_volume()
2153-
found = False
2154-
for volume in volumes:
2155-
if volume.name == name:
2156-
found = True
2152+
try:
2153+
volumes = client.list_volume()
2154+
found = False
2155+
for volume in volumes:
2156+
if volume.name == name:
2157+
found = True
2158+
break
2159+
if not found:
21572160
break
2158-
if not found:
2159-
break
2161+
except Exception as e:
2162+
print(f"Exception when waiting for volume deletion: {e}")
21602163
time.sleep(RETRY_INTERVAL)
21612164
assert not found
21622165

0 commit comments

Comments
 (0)