Add assertNotEmpty to avoid IndexError
In VolumePoolsAdminTestsJSON, if no cinder pools is listed,
we get "IndexError: list index out of range", so we should
check whether cinder_pools is empty before using it.
Change-Id: I55c163993b4956458b8658dae9d11b61171b8b55
Closes-Bug: #1844772
diff --git a/tempest/api/volume/admin/test_volume_pools.py b/tempest/api/volume/admin/test_volume_pools.py
index d389c26..744bc01 100644
--- a/tempest/api/volume/admin/test_volume_pools.py
+++ b/tempest/api/volume/admin/test_volume_pools.py
@@ -24,6 +24,7 @@
def _assert_pools(self, with_detail=False):
cinder_pools = self.admin_scheduler_stats_client.list_pools(
detail=with_detail)['pools']
+ self.assertNotEmpty(cinder_pools, "no cinder pools listed.")
self.assertIn('name', cinder_pools[0])
if with_detail:
self.assertIn(CONF.volume.vendor_name,