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
diff --git a/manila_tempest_tests/config.py b/manila_tempest_tests/config.py
index 9e4a168..ab76f8f 100644
--- a/manila_tempest_tests/config.py
+++ b/manila_tempest_tests/config.py
@@ -30,7 +30,7 @@
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",
diff --git a/manila_tempest_tests/services/share/v2/json/shares_client.py b/manila_tempest_tests/services/share/v2/json/shares_client.py
index 89a948e..fdcb3cb 100644
--- a/manila_tempest_tests/services/share/v2/json/shares_client.py
+++ b/manila_tempest_tests/services/share/v2/json/shares_client.py
@@ -820,6 +820,8 @@
'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)
diff --git a/manila_tempest_tests/tests/api/admin/test_share_types.py b/manila_tempest_tests/tests/api/admin/test_share_types.py
index 2df0561..dfa9fe7 100644
--- a/manila_tempest_tests/tests/api/admin/test_share_types.py
+++ b/manila_tempest_tests/tests/api/admin/test_share_types.py
@@ -58,18 +58,30 @@
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 @@
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 @@
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"]
diff --git a/manila_tempest_tests/tests/api/admin/test_share_types_negative.py b/manila_tempest_tests/tests/api/admin/test_share_types_negative.py
index b3bf855..62d38cc 100644
--- a/manila_tempest_tests/tests/api/admin/test_share_types_negative.py
+++ b/manila_tempest_tests/tests/api/admin/test_share_types_negative.py
@@ -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 manila_tempest_tests.tests.api import base
+@ddt.ddt
class ShareTypesAdminNegativeTest(base.BaseSharesMixedTest):
def _create_share_type(self):
@@ -49,6 +51,18 @@
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,
self.admin_shares_v2_client.get_share_type,