Skip to content

Commit 128b404

Browse files
Add cleanup for resources in error state
Signed-off-by: Markus Hentsch <[email protected]>
1 parent d41d1c4 commit 128b404

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Tests/iaas/volume-backup/volume-backup-tester.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,10 +164,10 @@ def cleanup(conn: openstack.connection.Connection, prefix=DEFAULT_PREFIX,
164164
"""
165165

166166
def wait_for_resource(resource_type: str, resource_id: str,
167-
expected_status="available") -> None:
167+
expected_status=["available"]) -> None:
168168
seconds_waited = 0
169169
get_func = getattr(conn.block_storage, f"get_{resource_type}")
170-
while get_func(resource_id).status != expected_status:
170+
while get_func(resource_id).status not in expected_status:
171171
time.sleep(1.0)
172172
seconds_waited += 1
173173
assert seconds_waited < timeout, (
@@ -184,7 +184,7 @@ def wait_for_resource(resource_type: str, resource_id: str,
184184
for backup in backups:
185185
if backup.name.startswith(prefix):
186186
try:
187-
wait_for_resource("backup", backup.id)
187+
wait_for_resource("backup", backup.id, ["available", "error"])
188188
except openstack.exceptions.ResourceNotFound:
189189
# if the resource has vanished on
190190
# its own in the meantime ignore it
@@ -209,7 +209,7 @@ def wait_for_resource(resource_type: str, resource_id: str,
209209
for volume in volumes:
210210
if volume.name.startswith(prefix):
211211
try:
212-
wait_for_resource("volume", volume.id)
212+
wait_for_resource("volume", volume.id, ["available", "error"])
213213
except openstack.exceptions.ResourceNotFound:
214214
# if the resource has vanished on
215215
# its own in the meantime ignore it

0 commit comments

Comments
 (0)