test_create_server_from_volume_snapshot: assert dict is not empty before accessing a key

Following the patch: If2a257b24f2d50a401d6804e983bcad55b5c89e8
In case the dict is empty i.e. there in not an attachment, it will
be helpful to check whether there is an attachment or not to prevent
error in L204.

Change-Id: Ib74472b3b147f34a63ac5988c7db97230a9f4803
This commit is contained in:
lkuchlan 2017-02-05 15:38:29 +02:00
parent dfa619cc66
commit 9e22b852d0

View File

@ -198,6 +198,8 @@ class TestVolumeBootPattern(manager.ScenarioTest):
# The created volume when creating a server from a snapshot
created_volume = server_info['os-extended-volumes:volumes_attached']
self.assertNotEmpty(created_volume, "No volume attachment found.")
created_volume_info = self.volumes_client.show_volume(
created_volume[0]['id'])['volume']