From 9e22b852d09974ea2a5af85150c770792d7e3f39 Mon Sep 17 00:00:00 2001 From: lkuchlan Date: Sun, 5 Feb 2017 15:38:29 +0200 Subject: [PATCH] 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 --- tempest/scenario/test_volume_boot_pattern.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tempest/scenario/test_volume_boot_pattern.py b/tempest/scenario/test_volume_boot_pattern.py index 9486b96a73..4064e049da 100644 --- a/tempest/scenario/test_volume_boot_pattern.py +++ b/tempest/scenario/test_volume_boot_pattern.py @@ -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']