Merge "[Tempest] Fix negative replication test"
diff --git a/manila_tempest_tests/config.py b/manila_tempest_tests/config.py
index 4e51ad5..3427b5d 100644
--- a/manila_tempest_tests/config.py
+++ b/manila_tempest_tests/config.py
@@ -17,8 +17,6 @@
from oslo_config import cfg
-from tempest import config # noqa
-
service_available_group = cfg.OptGroup(name="service_available",
title="Available OpenStack Services")
@@ -36,7 +34,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.16",
+ default="2.17",
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/json/shares_client.py b/manila_tempest_tests/services/share/json/shares_client.py
index bf8ce2a..eb304f3 100644
--- a/manila_tempest_tests/services/share/json/shares_client.py
+++ b/manila_tempest_tests/services/share/json/shares_client.py
@@ -19,7 +19,7 @@
import six
from six.moves.urllib import parse as urlparse
-from tempest import config # noqa
+from tempest import config
from tempest.lib.common import rest_client
from tempest.lib.common.utils import data_utils
from tempest.lib import exceptions
diff --git a/manila_tempest_tests/tests/api/admin/test_admin_actions.py b/manila_tempest_tests/tests/api/admin/test_admin_actions.py
index bc89642..40b2460 100644
--- a/manila_tempest_tests/tests/api/admin/test_admin_actions.py
+++ b/manila_tempest_tests/tests/api/admin/test_admin_actions.py
@@ -13,9 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
-from tempest import config # noqa
-from tempest import test # noqa
-import testtools # noqa
+from tempest import config
+from tempest import test
+import testtools
from manila_tempest_tests.tests.api import base
diff --git a/manila_tempest_tests/tests/api/admin/test_migration.py b/manila_tempest_tests/tests/api/admin/test_migration.py
index f808a44..a5ceaa4 100644
--- a/manila_tempest_tests/tests/api/admin/test_migration.py
+++ b/manila_tempest_tests/tests/api/admin/test_migration.py
@@ -13,8 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.
-from tempest import config # noqa
-from tempest import test # noqa
+from tempest import config
+from tempest import test
from manila_tempest_tests.tests.api import base
from manila_tempest_tests import utils
diff --git a/manila_tempest_tests/tests/api/admin/test_migration_negative.py b/manila_tempest_tests/tests/api/admin/test_migration_negative.py
index 348e5fa..127be01 100644
--- a/manila_tempest_tests/tests/api/admin/test_migration_negative.py
+++ b/manila_tempest_tests/tests/api/admin/test_migration_negative.py
@@ -13,9 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
-from tempest import config # noqa
-from tempest.lib import exceptions as lib_exc # noqa
-from tempest import test # noqa
+from tempest import config
+from tempest.lib import exceptions as lib_exc
+from tempest import test
from manila_tempest_tests.tests.api import base
diff --git a/manila_tempest_tests/tests/api/admin/test_multi_backend.py b/manila_tempest_tests/tests/api/admin/test_multi_backend.py
index 57fb9fd..20659b1 100644
--- a/manila_tempest_tests/tests/api/admin/test_multi_backend.py
+++ b/manila_tempest_tests/tests/api/admin/test_multi_backend.py
@@ -13,9 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
-from tempest import config # noqa
-from tempest.lib.common.utils import data_utils # noqa
-from tempest import test # noqa
+from tempest import config
+from tempest.lib.common.utils import data_utils
+from tempest import test
from manila_tempest_tests.tests.api import base
diff --git a/manila_tempest_tests/tests/api/admin/test_scheduler_stats.py b/manila_tempest_tests/tests/api/admin/test_scheduler_stats.py
index 2fa6be9..7e1449a 100644
--- a/manila_tempest_tests/tests/api/admin/test_scheduler_stats.py
+++ b/manila_tempest_tests/tests/api/admin/test_scheduler_stats.py
@@ -12,9 +12,8 @@
# License for the specific language governing permissions and limitations
# under the License.
-from tempest import config # noqa
-from tempest.lib import exceptions as lib_exc # noqa
-from tempest import test # noqa
+from tempest import config
+from tempest import test
from manila_tempest_tests.tests.api import base
diff --git a/manila_tempest_tests/tests/api/admin/test_security_services.py b/manila_tempest_tests/tests/api/admin/test_security_services.py
index 79169ff..6ba04be 100644
--- a/manila_tempest_tests/tests/api/admin/test_security_services.py
+++ b/manila_tempest_tests/tests/api/admin/test_security_services.py
@@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-from tempest import test # noqa
+from tempest import test
from manila_tempest_tests.tests.api import base
from manila_tempest_tests.tests.api import test_security_services
diff --git a/manila_tempest_tests/tests/api/admin/test_share_networks.py b/manila_tempest_tests/tests/api/admin/test_share_networks.py
index b3df760..1c11647 100644
--- a/manila_tempest_tests/tests/api/admin/test_share_networks.py
+++ b/manila_tempest_tests/tests/api/admin/test_share_networks.py
@@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-from tempest import test # noqa
+from tempest import test
from manila_tempest_tests.tests.api import base
from manila_tempest_tests.tests.api import test_share_networks
diff --git a/manila_tempest_tests/tests/api/admin/test_share_servers.py b/manila_tempest_tests/tests/api/admin/test_share_servers.py
index 9509cb1..e08a7a4 100644
--- a/manila_tempest_tests/tests/api/admin/test_share_servers.py
+++ b/manila_tempest_tests/tests/api/admin/test_share_servers.py
@@ -15,10 +15,10 @@
import re
-import six # noqa
-from tempest import config # noqa
-from tempest.lib import exceptions as lib_exc # noqa
-from tempest import test # noqa
+import six
+from tempest import config
+from tempest.lib import exceptions as lib_exc
+from tempest import test
from manila_tempest_tests.tests.api import base
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 5dc462d..d55b01e 100644
--- a/manila_tempest_tests/tests/api/admin/test_share_types.py
+++ b/manila_tempest_tests/tests/api/admin/test_share_types.py
@@ -14,10 +14,10 @@
# under the License.
import ddt
-from tempest import config # noqa
-from tempest.lib.common.utils import data_utils # noqa
-from tempest.lib import exceptions as lib_exc # noqa
-from tempest import test # noqa
+from tempest import config
+from tempest.lib.common.utils import data_utils
+from tempest.lib import exceptions as lib_exc
+from tempest import test
from manila_tempest_tests.tests.api import base
from manila_tempest_tests import utils
diff --git a/manila_tempest_tests/tests/api/admin/test_share_types_extra_specs.py b/manila_tempest_tests/tests/api/admin/test_share_types_extra_specs.py
index 7ee3f7b..f550ca6 100644
--- a/manila_tempest_tests/tests/api/admin/test_share_types_extra_specs.py
+++ b/manila_tempest_tests/tests/api/admin/test_share_types_extra_specs.py
@@ -15,8 +15,8 @@
import copy
-from tempest.lib.common.utils import data_utils # noqa
-from tempest import test # noqa
+from tempest.lib.common.utils import data_utils
+from tempest import test
from manila_tempest_tests.tests.api import base
diff --git a/manila_tempest_tests/tests/api/admin/test_shares_actions.py b/manila_tempest_tests/tests/api/admin/test_shares_actions.py
index c8966a2..49ebfbf 100644
--- a/manila_tempest_tests/tests/api/admin/test_shares_actions.py
+++ b/manila_tempest_tests/tests/api/admin/test_shares_actions.py
@@ -13,10 +13,10 @@
# License for the specific language governing permissions and limitations
# under the License.
-from tempest import config # noqa
-from tempest.lib.common.utils import data_utils # noqa
-from tempest import test # noqa
-import testtools # noqa
+from tempest import config
+from tempest.lib.common.utils import data_utils
+from tempest import test
+import testtools
from manila_tempest_tests.tests.api import base
diff --git a/manila_tempest_tests/tests/api/admin/test_snapshot_manage.py b/manila_tempest_tests/tests/api/admin/test_snapshot_manage.py
index 3eed886..ecdd3bd 100644
--- a/manila_tempest_tests/tests/api/admin/test_snapshot_manage.py
+++ b/manila_tempest_tests/tests/api/admin/test_snapshot_manage.py
@@ -13,6 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
+import ddt
import six
from tempest import config
from tempest.lib.common.utils import data_utils
@@ -21,10 +22,12 @@
import testtools
from manila_tempest_tests.tests.api import base
+from manila_tempest_tests import utils
CONF = config.CONF
+@ddt.ddt
class ManageNFSSnapshotTest(base.BaseSharesAdminTest):
protocol = 'nfs'
@@ -59,31 +62,12 @@
cleanup_in_class=True,
extra_specs=cls.extra_specs)
- creation_data = {'kwargs': {
- 'share_type_id': cls.st['share_type']['id'],
- 'share_protocol': cls.protocol,
- }}
+ # Create the base share
+ cls.share = cls.create_share(share_type_id=cls.st['share_type']['id'],
+ share_protocol=cls.protocol)
- # Data for creating shares
- data = [creation_data]
- shares_created = cls.create_shares(data)
-
- cls.snapshot = None
- cls.shares = []
- # Load all share data (host, etc.)
- for share in shares_created:
- cls.shares.append(cls.shares_v2_client.get_share(share['id']))
- # Create snapshot
- snap_name = data_utils.rand_name("tempest-snapshot-name")
- snap_desc = data_utils.rand_name(
- "tempest-snapshot-description")
- snap = cls.create_snapshot_wait_for_active(
- share['id'], snap_name, snap_desc)
- cls.snapshot = cls.shares_v2_client.get_snapshot(snap['id'])
- # Unmanage snapshot
- cls.shares_v2_client.unmanage_snapshot(snap['id'])
- cls.shares_client.wait_for_resource_deletion(
- snapshot_id=snap['id'])
+ # Get updated data
+ cls.share = cls.shares_v2_client.get_share(cls.share['id'])
def _test_manage(self, snapshot, version=CONF.share.max_api_microversion):
name = ("Name for 'managed' snapshot that had ID %s" %
@@ -97,7 +81,8 @@
snapshot['provider_location'],
name=name,
description=description,
- driver_options={}
+ driver_options={},
+ version=version,
)
# Add managed snapshot to cleanup queue
@@ -109,6 +94,19 @@
self.shares_v2_client.wait_for_snapshot_status(snapshot['id'],
'available')
+ # Verify manage snapshot API response
+ expected_keys = ["status", "links", "share_id", "name",
+ "share_proto", "created_at",
+ "description", "id", "share_size", "size",
+ "provider_location"]
+ if utils.is_microversion_ge(version, '2.17'):
+ expected_keys.extend(["user_id", "project_id"])
+
+ actual_keys = snapshot.keys()
+
+ # Strict key check
+ self.assertEqual(set(expected_keys), set(actual_keys))
+
# Verify data of managed snapshot
get_snapshot = self.shares_v2_client.get_snapshot(snapshot['id'])
self.assertEqual(name, get_snapshot['name'])
@@ -126,9 +124,31 @@
get_snapshot['id'])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_BACKEND])
- def test_manage(self):
+ @ddt.data('2.12', '2.16', CONF.share.max_api_microversion)
+ def test_manage_different_versions(self, version):
+ """Run snapshot manage test for multiple versions.
+
+ This test is configured with ddt to run for the configured maximum
+ version as well as versions 2.12 (when the API was introduced) and
+ 2.16.
+ """
+ # Skip in case specified version is not supported
+ utils.skip_if_microversion_not_supported(version)
+
+ snap_name = data_utils.rand_name("tempest-snapshot-name")
+ snap_desc = data_utils.rand_name("tempest-snapshot-description")
+ # Create snapshot
+ snapshot = self.create_snapshot_wait_for_active(
+ self.share['id'], snap_name, snap_desc)
+ snapshot = self.shares_v2_client.get_snapshot(snapshot['id'])
+ # Unmanage snapshot
+ self.shares_v2_client.unmanage_snapshot(snapshot['id'],
+ version=version)
+ self.shares_client.wait_for_resource_deletion(
+ snapshot_id=snapshot['id'])
+
# Manage snapshot
- self._test_manage(snapshot=self.snapshot)
+ self._test_manage(snapshot=snapshot, version=version)
class ManageCIFSSnapshotTest(ManageNFSSnapshotTest):
diff --git a/manila_tempest_tests/tests/api/test_consistency_groups.py b/manila_tempest_tests/tests/api/test_consistency_groups.py
index 45a462d..3c88554 100644
--- a/manila_tempest_tests/tests/api/test_consistency_groups.py
+++ b/manila_tempest_tests/tests/api/test_consistency_groups.py
@@ -13,10 +13,10 @@
# License for the specific language governing permissions and limitations
# under the License.
-from tempest import config # noqa
-from tempest.lib import exceptions as lib_exc # noqa
-from tempest import test # noqa
-import testtools # noqa
+from tempest import config
+from tempest.lib import exceptions as lib_exc
+from tempest import test
+import testtools
from manila_tempest_tests.tests.api import base
diff --git a/manila_tempest_tests/tests/api/test_extensions.py b/manila_tempest_tests/tests/api/test_extensions.py
index b9a6c9e..5dde050 100644
--- a/manila_tempest_tests/tests/api/test_extensions.py
+++ b/manila_tempest_tests/tests/api/test_extensions.py
@@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-from tempest import test # noqa
+from tempest import test
from manila_tempest_tests.tests.api import base
diff --git a/manila_tempest_tests/tests/api/test_limits.py b/manila_tempest_tests/tests/api/test_limits.py
index 8348b26..88567b5 100644
--- a/manila_tempest_tests/tests/api/test_limits.py
+++ b/manila_tempest_tests/tests/api/test_limits.py
@@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-from tempest import test # noqa
+from tempest import test
from manila_tempest_tests.tests.api import base
diff --git a/manila_tempest_tests/tests/api/test_metadata.py b/manila_tempest_tests/tests/api/test_metadata.py
index d075666..bc3efb4 100644
--- a/manila_tempest_tests/tests/api/test_metadata.py
+++ b/manila_tempest_tests/tests/api/test_metadata.py
@@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-from tempest import test # noqa
+from tempest import test
from manila_tempest_tests.tests.api import base
diff --git a/manila_tempest_tests/tests/api/test_metadata_negative.py b/manila_tempest_tests/tests/api/test_metadata_negative.py
index 7aec3e5..51f541a 100644
--- a/manila_tempest_tests/tests/api/test_metadata_negative.py
+++ b/manila_tempest_tests/tests/api/test_metadata_negative.py
@@ -14,8 +14,8 @@
# under the License.
import ddt
-from tempest.lib import exceptions as lib_exc # noqa
-from tempest import test # noqa
+from tempest.lib import exceptions as lib_exc
+from tempest import test
from manila_tempest_tests.tests.api import base
diff --git a/manila_tempest_tests/tests/api/test_scheduler_stats_negative.py b/manila_tempest_tests/tests/api/test_scheduler_stats_negative.py
index c9aac84..a23f2a5 100644
--- a/manila_tempest_tests/tests/api/test_scheduler_stats_negative.py
+++ b/manila_tempest_tests/tests/api/test_scheduler_stats_negative.py
@@ -13,8 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.
-from tempest.lib import exceptions as lib_exc # noqa
-from tempest import test # noqa
+from tempest.lib import exceptions as lib_exc
+from tempest import test
from manila_tempest_tests.tests.api import base
diff --git a/manila_tempest_tests/tests/api/test_security_services.py b/manila_tempest_tests/tests/api/test_security_services.py
index bd78fb3..1acf07c 100644
--- a/manila_tempest_tests/tests/api/test_security_services.py
+++ b/manila_tempest_tests/tests/api/test_security_services.py
@@ -13,11 +13,11 @@
# License for the specific language governing permissions and limitations
# under the License.
-from oslo_log import log # noqa
-import six # noqa
-from tempest import config # noqa
-from tempest import test # noqa
-import testtools # noqa
+from oslo_log import log
+import six
+from tempest import config
+from tempest import test
+import testtools
from manila_tempest_tests.tests.api import base
diff --git a/manila_tempest_tests/tests/api/test_security_services_mapping.py b/manila_tempest_tests/tests/api/test_security_services_mapping.py
index 33d8ccb..52cbb7f 100644
--- a/manila_tempest_tests/tests/api/test_security_services_mapping.py
+++ b/manila_tempest_tests/tests/api/test_security_services_mapping.py
@@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-from tempest import test # noqa
+from tempest import test
from manila_tempest_tests.tests.api import base
diff --git a/manila_tempest_tests/tests/api/test_security_services_mapping_negative.py b/manila_tempest_tests/tests/api/test_security_services_mapping_negative.py
index 15010da..26e582b 100644
--- a/manila_tempest_tests/tests/api/test_security_services_mapping_negative.py
+++ b/manila_tempest_tests/tests/api/test_security_services_mapping_negative.py
@@ -13,12 +13,12 @@
# License for the specific language governing permissions and limitations
# under the License.
-from oslo_log import log # noqa
-import six # noqa
-from tempest import config # noqa
-from tempest.lib import exceptions as lib_exc # noqa
-from tempest import test # noqa
-import testtools # noqa
+from oslo_log import log
+import six
+from tempest import config
+from tempest.lib import exceptions as lib_exc
+from tempest import test
+import testtools
from manila_tempest_tests.tests.api import base
diff --git a/manila_tempest_tests/tests/api/test_security_services_negative.py b/manila_tempest_tests/tests/api/test_security_services_negative.py
index f7966f5..1b0a4d3 100644
--- a/manila_tempest_tests/tests/api/test_security_services_negative.py
+++ b/manila_tempest_tests/tests/api/test_security_services_negative.py
@@ -13,12 +13,12 @@
# License for the specific language governing permissions and limitations
# under the License.
-from oslo_log import log # noqa
-import six # noqa
-from tempest import config # noqa
-from tempest.lib import exceptions as lib_exc # noqa
-from tempest import test # noqa
-import testtools # noqa
+from oslo_log import log
+import six
+from tempest import config
+from tempest.lib import exceptions as lib_exc
+from tempest import test
+import testtools
from manila_tempest_tests.tests.api import base
diff --git a/manila_tempest_tests/tests/api/test_share_networks.py b/manila_tempest_tests/tests/api/test_share_networks.py
index bd3698b..ef8bb01 100644
--- a/manila_tempest_tests/tests/api/test_share_networks.py
+++ b/manila_tempest_tests/tests/api/test_share_networks.py
@@ -13,10 +13,10 @@
# License for the specific language governing permissions and limitations
# under the License.
-import six # noqa
-from tempest import config # noqa
-from tempest import test # noqa
-import testtools # noqa
+import six
+from tempest import config
+from tempest import test
+import testtools
from manila_tempest_tests.tests.api import base
diff --git a/manila_tempest_tests/tests/api/test_share_networks_negative.py b/manila_tempest_tests/tests/api/test_share_networks_negative.py
index f9b341c..0fb618c 100644
--- a/manila_tempest_tests/tests/api/test_share_networks_negative.py
+++ b/manila_tempest_tests/tests/api/test_share_networks_negative.py
@@ -13,10 +13,10 @@
# License for the specific language governing permissions and limitations
# under the License.
-from tempest import config # noqa
-from tempest.lib import exceptions as lib_exc # noqa
-from tempest import test # noqa
-import testtools # noqa
+from tempest import config
+from tempest.lib import exceptions as lib_exc
+from tempest import test
+import testtools
from manila_tempest_tests.tests.api import base
diff --git a/manila_tempest_tests/tests/api/test_shares.py b/manila_tempest_tests/tests/api/test_shares.py
index 1da57e4..2acd81a 100644
--- a/manila_tempest_tests/tests/api/test_shares.py
+++ b/manila_tempest_tests/tests/api/test_shares.py
@@ -104,14 +104,26 @@
# create snapshot
snap = self.create_snapshot_wait_for_active(self.share["id"])
+
detailed_elements = {'name', 'id', 'description',
'created_at', 'share_proto', 'size', 'share_size',
'share_id', 'status', 'links'}
- self.assertTrue(detailed_elements.issubset(snap.keys()),
- 'At least one expected element missing from snapshot '
- 'response. Expected %(expected)s, got %(actual)s.' % {
- "expected": detailed_elements,
- "actual": snap.keys()})
+ msg = (
+ "At least one expected element missing from share "
+ "response. Expected %(expected)s, got %(actual)s." % {
+ "expected": detailed_elements,
+ "actual": snap.keys(),
+ }
+ )
+ self.assertTrue(detailed_elements.issubset(snap.keys()), msg)
+
+ # In v2.17 and beyond, we expect user_id and project_id keys
+ if utils.is_microversion_supported('2.17'):
+ detailed_elements.update({'user_id', 'project_id'})
+ self.assertTrue(detailed_elements.issubset(snap.keys()), msg)
+ else:
+ self.assertNotIn('user_id', detailed_elements)
+ self.assertNotIn('project_id', detailed_elements)
# delete snapshot
self.shares_client.delete_snapshot(snap["id"])
diff --git a/manila_tempest_tests/tests/api/test_shares_actions.py b/manila_tempest_tests/tests/api/test_shares_actions.py
index 16b8b58..3d4c54b 100644
--- a/manila_tempest_tests/tests/api/test_shares_actions.py
+++ b/manila_tempest_tests/tests/api/test_shares_actions.py
@@ -13,6 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
+import ddt
import six
from tempest import config
from tempest.lib.common.utils import data_utils
@@ -23,8 +24,10 @@
from manila_tempest_tests import utils
CONF = config.CONF
+LATEST_MICROVERSION = CONF.share.max_api_microversion
+@ddt.ddt
class SharesActionsTest(base.BaseSharesTest):
"""Covers share functionality, that doesn't related to share type."""
@@ -399,30 +402,58 @@
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
- def test_get_snapshot(self):
+ @ddt.data(None, '2.16', LATEST_MICROVERSION)
+ def test_get_snapshot(self, version):
# get snapshot
- get = self.shares_client.get_snapshot(self.snap["id"])
+ if version is None:
+ snapshot = self.shares_client.get_snapshot(self.snap["id"])
+ else:
+ utils.skip_if_microversion_not_supported(version)
+ snapshot = self.shares_v2_client.get_snapshot(
+ self.snap["id"], version=version)
# verify keys
expected_keys = ["status", "links", "share_id", "name",
"share_proto", "created_at",
- "description", "id", "share_size"]
- actual_keys = get.keys()
- [self.assertIn(key, actual_keys) for key in expected_keys]
+ "description", "id", "share_size", "size"]
+ if version and utils.is_microversion_ge(version, '2.17'):
+ expected_keys.extend(["user_id", "project_id"])
+ actual_keys = snapshot.keys()
+
+ # strict key check
+ self.assertEqual(set(expected_keys), set(actual_keys))
# verify data
msg = "Expected name: '%s', actual name: '%s'" % (self.snap_name,
- get["name"])
- self.assertEqual(self.snap_name, get["name"], msg)
+ snapshot["name"])
+ self.assertEqual(self.snap_name, snapshot["name"], msg)
- msg = "Expected description: '%s', "\
- "actual description: '%s'" % (self.snap_desc, get["description"])
- self.assertEqual(self.snap_desc, get["description"], msg)
+ msg = ("Expected description: '%s' actual description: '%s'" %
+ (self.snap_desc, snapshot["description"]))
+ self.assertEqual(self.snap_desc, snapshot["description"], msg)
- msg = "Expected share_id: '%s', "\
- "actual share_id: '%s'" % (self.shares[0]["id"], get["share_id"])
- self.assertEqual(self.shares[0]["id"], get["share_id"], msg)
+ msg = ("Expected share_id: '%s', actual share_id: '%s'" %
+ (self.shares[0]["id"], snapshot["share_id"]))
+ self.assertEqual(self.shares[0]["id"], snapshot["share_id"], msg)
+
+ # Verify that the user_id and project_id are same as the one for
+ # the base share
+ if version and utils.is_microversion_ge(version, '2.17'):
+ msg = ("Expected %(key)s in snapshot: '%(expected)s', "
+ "actual %(key)s in snapshot: '%(actual)s'")
+ self.assertEqual(self.shares[0]['user_id'],
+ snapshot['user_id'],
+ msg % {
+ 'expected': self.shares[0]['user_id'],
+ 'actual': snapshot['user_id'],
+ 'key': 'user_id'})
+ self.assertEqual(self.shares[0]['project_id'],
+ snapshot['project_id'],
+ msg % {
+ 'expected': self.shares[0]['project_id'],
+ 'actual': snapshot['project_id'],
+ 'key': 'project_id'})
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
@testtools.skipUnless(CONF.share.run_snapshot_tests,
@@ -444,16 +475,26 @@
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
- def test_list_snapshots_with_detail(self):
+ @ddt.data(None, '2.16', LATEST_MICROVERSION)
+ def test_list_snapshots_with_detail(self, version):
# list share snapshots
- snaps = self.shares_client.list_snapshots_with_detail()
+ if version is None:
+ snaps = self.shares_client.list_snapshots_with_detail()
+ else:
+ utils.skip_if_microversion_not_supported(version)
+ snaps = self.shares_v2_client.list_snapshots_with_detail(
+ version=version)
# verify keys
- keys = ["status", "links", "share_id", "name",
- "share_proto", "created_at",
- "description", "id", "share_size"]
- [self.assertIn(key, sn.keys()) for sn in snaps for key in keys]
+ expected_keys = ["status", "links", "share_id", "name",
+ "share_proto", "created_at", "description", "id",
+ "share_size", "size"]
+ if version and utils.is_microversion_ge(version, '2.17'):
+ expected_keys.extend(["user_id", "project_id"])
+
+ # strict key check
+ [self.assertEqual(set(expected_keys), set(s.keys())) for s in snaps]
# our share id in list and have no duplicates
gen = [sid["id"] for sid in snaps if sid["id"] in self.snap["id"]]
diff --git a/manila_tempest_tests/tests/api/test_shares_negative.py b/manila_tempest_tests/tests/api/test_shares_negative.py
index a8a4a6b..835aa33 100644
--- a/manila_tempest_tests/tests/api/test_shares_negative.py
+++ b/manila_tempest_tests/tests/api/test_shares_negative.py
@@ -13,10 +13,10 @@
# License for the specific language governing permissions and limitations
# under the License.
-from tempest import config # noqa
-from tempest.lib import exceptions as lib_exc # noqa
-from tempest import test # noqa
-import testtools # noqa
+from tempest import config
+from tempest.lib import exceptions as lib_exc
+from tempest import test
+import testtools
from manila_tempest_tests import share_exceptions
from manila_tempest_tests.tests.api import base
diff --git a/manila_tempest_tests/tests/scenario/test_share_basic_ops.py b/manila_tempest_tests/tests/scenario/test_share_basic_ops.py
index 261a886..a3e0e1f 100644
--- a/manila_tempest_tests/tests/scenario/test_share_basic_ops.py
+++ b/manila_tempest_tests/tests/scenario/test_share_basic_ops.py
@@ -14,11 +14,11 @@
# under the License.
from oslo_log import log as logging
-from tempest import config # noqa
+from tempest import config
from tempest.lib.common.utils import data_utils
from tempest.lib.common.utils import test_utils
from tempest.lib import exceptions
-from tempest import test # noqa
+from tempest import test
from manila_tempest_tests.tests.api import base
from manila_tempest_tests.tests.scenario import manager_share as manager