Improve tempest tests for shares listing APIs
In manila_tempest_tests/tests/api/test_shares_actions.py,
tempest tests for share list and detail APIs so far only
assert the presence of the 'snapshot_support' key in
addition to some basic keys.
Add assertions for keys introduced in later microversions.
Include more 'basic keys' that are expected to be
part of the response for these APIs before v2.1.
Leverage the microversion comparison methods introduced
in commit 8caad2655cede5f7146dceb609aaecfd2d2075da
and skip tests beyond microversion 2.4 if tempest is
configured for a lower microversion.
Also, un-skip QA checks in the file.
Change-Id: I65913098ae10de245844728f298fe6474e3ca628
Closes-Bug: 1528456
diff --git a/manila_tempest_tests/tests/api/test_shares_actions.py b/manila_tempest_tests/tests/api/test_shares_actions.py
index 58ddbfe..36fd6e5 100644
--- a/manila_tempest_tests/tests/api/test_shares_actions.py
+++ b/manila_tempest_tests/tests/api/test_shares_actions.py
@@ -14,12 +14,13 @@
# under the License.
import six
-from tempest import config # noqa
-from tempest import test # noqa
-from tempest_lib.common.utils import data_utils # noqa
-import testtools # noqa
+from tempest import config
+from tempest import test
+from tempest_lib.common.utils import data_utils
+import testtools
from manila_tempest_tests.tests.api import base
+from manila_tempest_tests import utils
CONF = config.CONF
@@ -79,11 +80,20 @@
self.shares[0]['id'], version=six.text_type(version))
# verify keys
- expected_keys = ["status", "description", "links", "availability_zone",
- "created_at", "export_location", "share_proto",
- "name", "snapshot_id", "id", "size"]
- if version > 2.1:
+ expected_keys = [
+ "status", "description", "links", "availability_zone",
+ "created_at", "export_location", "project_id",
+ "export_locations", "volume_type", "share_proto", "name",
+ "snapshot_id", "id", "size", "share_network_id", "metadata",
+ "host", "snapshot_id", "is_public",
+ ]
+ if utils.is_microversion_ge(version, '2.2'):
expected_keys.append("snapshot_support")
+ if utils.is_microversion_ge(version, '2.4'):
+ expected_keys.extend(["consistency_group_id",
+ "source_cgsnapshot_member_id"])
+ if utils.is_microversion_ge(version, '2.5'):
+ expected_keys.append("share_type_name")
actual_keys = list(share.keys())
[self.assertIn(key, actual_keys) for key in expected_keys]
@@ -103,12 +113,22 @@
self.assertEqual(self.share_size, int(share["size"]), msg)
@test.attr(type=["gate", ])
- def test_get_share_no_snapshot_support_key(self):
- self._get_share(2.1)
+ def test_get_share_v2_1(self):
+ self._get_share('2.1')
@test.attr(type=["gate", ])
def test_get_share_with_snapshot_support_key(self):
- self._get_share(2.2)
+ self._get_share('2.2')
+
+ @test.attr(type=["gate", ])
+ @utils.skip_if_microversion_not_supported('2.4')
+ def test_get_share_with_consistency_groups_keys(self):
+ self._get_share('2.4')
+
+ @test.attr(type=["gate", ])
+ @utils.skip_if_microversion_not_supported('2.6')
+ def test_get_share_with_share_type_name_key(self):
+ self._get_share('2.6')
@test.attr(type=["gate", ])
def test_list_shares(self):
@@ -135,11 +155,19 @@
# verify keys
keys = [
"status", "description", "links", "availability_zone",
- "created_at", "export_location", "share_proto", "host",
- "name", "snapshot_id", "id", "size", "project_id",
+ "created_at", "export_location", "project_id",
+ "export_locations", "volume_type", "share_proto", "name",
+ "snapshot_id", "id", "size", "share_network_id", "metadata",
+ "host", "snapshot_id", "is_public", "share_type",
]
- if version > 2.1:
+ if utils.is_microversion_ge(version, '2.2'):
keys.append("snapshot_support")
+ if utils.is_microversion_ge(version, '2.4'):
+ keys.extend(["consistency_group_id",
+ "source_cgsnapshot_member_id"])
+ if utils.is_microversion_ge(version, '2.6'):
+ keys.append("share_type_name")
+
[self.assertIn(key, sh.keys()) for sh in shares for key in keys]
# our shares in list and have no duplicates
@@ -149,12 +177,22 @@
self.assertEqual(1, len(gen), msg)
@test.attr(type=["gate", ])
- def test_list_shares_with_detail_without_snapshot_support_key(self):
- self._list_shares_with_detail(2.1)
+ def test_list_shares_with_detail_v2_1(self):
+ self._list_shares_with_detail('2.1')
@test.attr(type=["gate", ])
def test_list_shares_with_detail_and_snapshot_support_key(self):
- self._list_shares_with_detail(2.2)
+ self._list_shares_with_detail('2.2')
+
+ @test.attr(type=["gate", ])
+ @utils.skip_if_microversion_not_supported('2.4')
+ def test_list_shares_with_detail_consistency_groups_keys(self):
+ self._list_shares_with_detail('2.4')
+
+ @test.attr(type=["gate", ])
+ @utils.skip_if_microversion_not_supported('2.6')
+ def test_list_shares_with_detail_share_type_name_key(self):
+ self._list_shares_with_detail('2.6')
@test.attr(type=["gate", ])
def test_list_shares_with_detail_filter_by_metadata(self):