Add new tests to keep repo up to date
While the in-tree tempest plugin is not removed from manila repo, we need to keep new changes in sync. This is related to https://review.openstack.org/#/c/512572/ Change-Id: I48d5fcd0d783fbb9334758eaab30e720e7757919
This commit is contained in:
parent
80f5fbf2c9
commit
ad0dc1dedd
|
@ -30,7 +30,7 @@ ShareGroup = [
|
|||
help="The minimum api microversion is configured to be the "
|
||||
"value of the minimum microversion supported by Manila."),
|
||||
cfg.StrOpt("max_api_microversion",
|
||||
default="2.40",
|
||||
default="2.41",
|
||||
help="The maximum api microversion is configured to be the "
|
||||
"value of the latest microversion supported by Manila."),
|
||||
cfg.StrOpt("region",
|
||||
|
|
|
@ -820,6 +820,8 @@ class SharesV2Client(shares_client.SharesClient):
|
|||
'extra_specs': kwargs.get('extra_specs'),
|
||||
is_public_keyname: is_public,
|
||||
}
|
||||
if kwargs.get('description'):
|
||||
post_body['description'] = kwargs.get('description')
|
||||
post_body = json.dumps({'share_type': post_body})
|
||||
resp, body = self.post('types', post_body, version=version)
|
||||
self.expected_success(200, resp.status)
|
||||
|
|
|
@ -58,18 +58,30 @@ class ShareTypesAdminTest(base.BaseSharesAdminTest):
|
|||
self.assertIn(old_key_name, share_type)
|
||||
self.assertNotIn(new_key_name, share_type)
|
||||
|
||||
def _verify_description(self, expect_des, share_type, version):
|
||||
if utils.is_microversion_ge(version, "2.41"):
|
||||
self.assertEqual(expect_des, share_type['description'])
|
||||
else:
|
||||
self.assertNotIn('description', share_type)
|
||||
|
||||
@tc.attr(base.TAG_POSITIVE, base.TAG_API)
|
||||
@ddt.data('2.0', '2.6', '2.7')
|
||||
@ddt.data('2.0', '2.6', '2.7', '2.40', '2.41')
|
||||
def test_share_type_create_get(self, version):
|
||||
self.skip_if_microversion_not_supported(version)
|
||||
|
||||
name = data_utils.rand_name("tempest-manila")
|
||||
description = None
|
||||
if utils.is_microversion_ge(version, "2.41"):
|
||||
description = "Description for share type"
|
||||
extra_specs = self.add_extra_specs_to_dict({"key": "value", })
|
||||
|
||||
# Create share type
|
||||
st_create = self.create_share_type(
|
||||
name, extra_specs=extra_specs, version=version)
|
||||
name, extra_specs=extra_specs, version=version,
|
||||
description=description)
|
||||
self.assertEqual(name, st_create['share_type']['name'])
|
||||
self._verify_description(
|
||||
description, st_create['share_type'], version)
|
||||
self._verify_is_public_key_name(st_create['share_type'], version)
|
||||
st_id = st_create["share_type"]["id"]
|
||||
|
||||
|
@ -77,6 +89,7 @@ class ShareTypesAdminTest(base.BaseSharesAdminTest):
|
|||
get = self.shares_v2_client.get_share_type(st_id, version=version)
|
||||
self.assertEqual(name, get["share_type"]["name"])
|
||||
self.assertEqual(st_id, get["share_type"]["id"])
|
||||
self._verify_description(description, get['share_type'], version)
|
||||
self.assertEqual(extra_specs, get["share_type"]["extra_specs"])
|
||||
self._verify_is_public_key_name(get['share_type'], version)
|
||||
|
||||
|
@ -84,16 +97,20 @@ class ShareTypesAdminTest(base.BaseSharesAdminTest):
|
|||
self.assertDictMatch(get["volume_type"], get["share_type"])
|
||||
|
||||
@tc.attr(base.TAG_POSITIVE, base.TAG_API)
|
||||
@ddt.data('2.0', '2.6', '2.7')
|
||||
@ddt.data('2.0', '2.6', '2.7', '2.40', '2.41')
|
||||
def test_share_type_create_list(self, version):
|
||||
self.skip_if_microversion_not_supported(version)
|
||||
|
||||
name = data_utils.rand_name("tempest-manila")
|
||||
description = None
|
||||
if utils.is_microversion_ge(version, "2.41"):
|
||||
description = "Description for share type"
|
||||
extra_specs = self.add_extra_specs_to_dict()
|
||||
|
||||
# Create share type
|
||||
st_create = self.create_share_type(
|
||||
name, extra_specs=extra_specs, version=version)
|
||||
name, extra_specs=extra_specs, version=version,
|
||||
description=description)
|
||||
self._verify_is_public_key_name(st_create['share_type'], version)
|
||||
st_id = st_create["share_type"]["id"]
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import ddt
|
||||
from tempest.lib.common.utils import data_utils
|
||||
from tempest.lib import exceptions as lib_exc
|
||||
from testtools import testcase as tc
|
||||
|
@ -20,6 +21,7 @@ from testtools import testcase as tc
|
|||
from manila_tempest_tests.tests.api import base
|
||||
|
||||
|
||||
@ddt.ddt
|
||||
class ShareTypesAdminNegativeTest(base.BaseSharesMixedTest):
|
||||
|
||||
def _create_share_type(self):
|
||||
|
@ -48,6 +50,18 @@ class ShareTypesAdminNegativeTest(base.BaseSharesMixedTest):
|
|||
"x" * 256,
|
||||
client=self.admin_shares_v2_client)
|
||||
|
||||
@tc.attr(base.TAG_NEGATIVE, base.TAG_API)
|
||||
@ddt.data('2.0', '2.6', '2.40')
|
||||
def test_create_share_type_with_description_in_wrong_version(
|
||||
self, version):
|
||||
self.assertRaises(lib_exc.BadRequest,
|
||||
self.create_share_type,
|
||||
data_utils.rand_name("tempest_type_name"),
|
||||
extra_specs=self.add_extra_specs_to_dict(),
|
||||
description="tempest_type_description",
|
||||
version=version,
|
||||
client=self.admin_shares_v2_client)
|
||||
|
||||
@tc.attr(base.TAG_NEGATIVE, base.TAG_API)
|
||||
def test_get_share_type_by_nonexistent_id(self):
|
||||
self.assertRaises(lib_exc.NotFound,
|
||||
|
|
Loading…
Reference in New Issue