Fix concurrency issue in tempest test

Tempest test 'test_list_shares_with_detail_filter_by_extra_specs' fails
with following error from time to time:

ValueError: Share 'cdd499f7-6b02-4f47-8b39-7093b4d07e11' listed with
extra_specs filter has nonexistent share type 'share-type-1283899337'.

It happens because list of share types is taken for each step of a loop
Get list of share types only once and before taking list of shares, in
that case we will have share objects with still existing share types.

Change-Id: I0c29d16385255599b902757544e31ebbec79ca84
Closes-Bug: #1493125
This commit is contained in:
Valeriy Ponomaryov 2015-09-08 13:19:15 +03:00
parent 6977b0196d
commit 06e9578447
1 changed files with 3 additions and 4 deletions

View File

@ -165,6 +165,7 @@ class SharesActionsAdminTest(base.BaseSharesAdminTest):
filters = {
"extra_specs": {'storage_protocol': CONF.share.storage_protocol}
}
share_type_list = self.shares_client.list_share_types()["share_types"]
# list shares
shares = self.shares_client.list_shares_with_detail(params=filters)
@ -175,12 +176,10 @@ class SharesActionsAdminTest(base.BaseSharesAdminTest):
for share in self.shares:
self.assertTrue(share["id"] in shares_ids)
for share in shares:
st_list = self.shares_client.list_share_types()
# find its name or id, get id
sts = st_list["share_types"]
st_id = None
for st in sts:
if share["share_type"] in [st["id"], st["name"]]:
for st in share_type_list:
if share["share_type"] in (st["id"], st["name"]):
st_id = st["id"]
break
if st_id is None: