Adds get default share type function

This patch set adds the get default share type
function to client used by our tempest tests.

Also leverages this new function to get the default
share type, instead of using the get share types
command which was breaking in case the default
share type name was different than "default"

Closes-Bug: #1905796
Change-Id: If3508cd17a8640e88b21110d1d61dc424b94709e
This commit is contained in:
Victoria Martinez de la Cruz 2020-11-26 23:27:53 +00:00
parent 6f593f486e
commit ada5b69c78
2 changed files with 6 additions and 2 deletions

View File

@ -637,6 +637,11 @@ class SharesClient(rest_client.RestClient):
self.expected_success(200, resp.status)
return self._parse_resp(body)
def get_default_share_type(self):
resp, body = self.get("types/default")
self.expected_success(200, resp.status)
return self._parse_resp(body)
def add_access_to_share_type(self, share_type_id, project_id):
uri = 'types/%s/action' % share_type_id
post_body = {'project': project_id}

View File

@ -452,8 +452,7 @@ class ShareScenarioTest(manager.NetworkScenarioTest):
def get_share_type(self):
if CONF.share.default_share_type_name:
return self.shares_client.get_share_type(
CONF.share.default_share_type_name)['share_type']
return self.shares_client.get_default_share_type()['share_type']
return self._create_share_type(
data_utils.rand_name("share_type"),
extra_specs={