From 1bac61822df89ffbc9ddb54e40b2b407c43b7c96 Mon Sep 17 00:00:00 2001 From: "jeremy.zhang" Date: Tue, 26 Sep 2017 22:08:15 +0800 Subject: [PATCH] Fix volume group test This patch mainly aims to fix GroupsTest.test_group_create_show_list_delete. The method to verify 'list' API is not quite right, it should check whether all the groups are present and unique in the result of list_groups. Change-Id: I882cdbc38efc6f876757db3d27344c68f4e54881 --- tempest/api/volume/admin/test_groups.py | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/tempest/api/volume/admin/test_groups.py b/tempest/api/volume/admin/test_groups.py index d4b2faa236..2775a868a7 100644 --- a/tempest/api/volume/admin/test_groups.py +++ b/tempest/api/volume/admin/test_groups.py @@ -108,16 +108,16 @@ class GroupsTest(BaseGroupsTest): self.assertEqual(grp2_id, grp2['id']) # Get all groups with detail - grps = self.groups_client.list_groups( - detail=True)['groups'] - filtered_grps = [g for g in grps if g['id'] in [grp1_id, grp2_id]] - self.assertEqual(2, len(filtered_grps)) - for grp in filtered_grps: - self.assertEqual([volume_type['id']], grp['volume_types']) - self.assertEqual(group_type['id'], grp['group_type']) + grps = self.groups_client.list_groups(detail=True)['groups'] + for grp_id in [grp1_id, grp2_id]: + filtered_grps = [g for g in grps if g['id'] == grp_id] + self.assertEqual(1, len(filtered_grps)) + self.assertEqual([volume_type['id']], + filtered_grps[0]['volume_types']) + self.assertEqual(group_type['id'], + filtered_grps[0]['group_type']) - vols = self.volumes_client.list_volumes( - detail=True)['volumes'] + vols = self.volumes_client.list_volumes(detail=True)['volumes'] filtered_vols = [v for v in vols if v['id'] in [vol1_id]] self.assertEqual(1, len(filtered_vols)) for vol in filtered_vols: @@ -297,8 +297,7 @@ class GroupsTest(BaseGroupsTest): self.assertEqual(new_desc, grp['description']) # Get volumes in the group - vols = self.volumes_client.list_volumes( - detail=True)['volumes'] + vols = self.volumes_client.list_volumes(detail=True)['volumes'] grp_vols = [v for v in vols if v['group_id'] == grp['id']] self.assertEqual(1, len(grp_vols))