AWS tests : catch AttributeError raised by latest moto release

Per the notes inline, the recent 3.1.6 moto release has changed the
way deleted images are returned.  Catching the exception we now see
works, and we can revisit if we find better solutions.

Change-Id: I3279c3b5cb8cf26d390835fd0a7049bc43ec40b5
Ian Wienand 2022-04-27 05:19:14 +10:00
parent dae31ef620
commit 8ffd70776a
1 changed files with 10 additions and 0 deletions

View File

@ -492,6 +492,16 @@ class TestDriverAws(tests.DBTestCase):
except botocore.exceptions.ClientError:
# Probably not found
except AttributeError:
# NOTE(ianw) 2022-04-27 For reasons that are unclear
# but have been filed as
# accessing the image.state property of a deleted image
# with moto 1.3.6 will no longer result in the ClientError
# above, but boto will get blank response and try to
# dereference a None value. Thus catching this is a
# work-around until we have a better solution.
for _ in iterate_timeout(30, Exception, 'snapshot deletion'):
snap = self.ec2.Snapshot(snapshot_id)