Merge "Fix broken api links in lib/services"
diff --git a/doc/source/conf.py b/doc/source/conf.py
index 201d387..4e7a72d 100644
--- a/doc/source/conf.py
+++ b/doc/source/conf.py
@@ -22,10 +22,8 @@
# All configuration values have a default; values that are commented out
# serve to show the default.
-import sys
import os
import subprocess
-import warnings
import openstackdocstheme
diff --git a/doc/source/microversion_testing.rst b/doc/source/microversion_testing.rst
index 60f4f36..336aa5b 100644
--- a/doc/source/microversion_testing.rst
+++ b/doc/source/microversion_testing.rst
@@ -296,46 +296,50 @@
* `2.1`_
- .. _2.1: https://docs.openstack.org/nova/latest/api_microversion_history.html#id1
+ .. _2.1: https://docs.openstack.org/nova/latest/reference/api-microversion-history.html#id1
* `2.2`_
- .. _2.2: http://docs.openstack.org/nova/latest/api_microversion_history.html#id2
+ .. _2.2: http://docs.openstack.org/nova/latest/reference/api-microversion-history.html#id2
* `2.10`_
- .. _2.10: http://docs.openstack.org/nova/latest/api_microversion_history.html#id9
+ .. _2.10: http://docs.openstack.org/nova/latest/reference/api-microversion-history.html#id9
* `2.20`_
- .. _2.20: http://docs.openstack.org/nova/latest/api_microversion_history.html#id18
+ .. _2.20: http://docs.openstack.org/nova/latest/reference/api-microversion-history.html#id18
* `2.25`_
- .. _2.25: http://docs.openstack.org/nova/latest/api_microversion_history.html#maximum-in-mitaka
+ .. _2.25: http://docs.openstack.org/nova/latest/reference/api-microversion-history.html#maximum-in-mitaka
* `2.32`_
- .. _2.32: http://docs.openstack.org/nova/latest/api_microversion_history.html#id29
+ .. _2.32: http://docs.openstack.org/nova/latest/reference/api-microversion-history.html#id29
* `2.37`_
- .. _2.37: http://docs.openstack.org/nova/latest/api_microversion_history.html#id34
+ .. _2.37: http://docs.openstack.org/nova/latest/reference/api-microversion-history.html#id34
* `2.42`_
- .. _2.42: http://docs.openstack.org/nova/latest/api_microversion_history.html#maximum-in-ocata
+ .. _2.42: http://docs.openstack.org/nova/latest/reference/api-microversion-history.html#maximum-in-ocata
* `2.47`_
- .. _2.47: http://docs.openstack.org/nova/latest/api_microversion_history.html#id42
+ .. _2.47: http://docs.openstack.org/nova/latest/reference/api-microversion-history.html#id42
- * `2.48`_
+ * `2.52`_
- .. _2.48: http://docs.openstack.org/nova/latest/api_microversion_history.html#id43
+ .. _2.52: https://docs.openstack.org/nova/latest/reference/api-microversion-history.html#id47
+
+ * `2.53`_
+
+ .. _2.53: https://docs.openstack.org/nova/latest/reference/api-microversion-history.html#id48
* Volume
* `3.3`_
- .. _3.3: https://docs.openstack.org/cinder/latest/devref/api_microversion_history.html#id4
+ .. _3.3: https://docs.openstack.org/cinder/ocata/devref/api_microversion_history.html#id4
diff --git a/releasenotes/notes/add-volume-group-snapshots-tempest-tests-840df3da26590f5e.yaml b/releasenotes/notes/add-volume-group-snapshots-tempest-tests-840df3da26590f5e.yaml
new file mode 100644
index 0000000..2ca6e5a
--- /dev/null
+++ b/releasenotes/notes/add-volume-group-snapshots-tempest-tests-840df3da26590f5e.yaml
@@ -0,0 +1,6 @@
+---
+features:
+ - |
+ Add group_snapshots client for the volume service as library.
+ Add tempest tests for create group snapshot, delete group snapshot, show
+ group snapshot, and list group snapshots volume APIs.
diff --git a/tempest/api/compute/security_groups/test_security_groups.py b/tempest/api/compute/security_groups/test_security_groups.py
index 930a58e..1a0dc4a 100644
--- a/tempest/api/compute/security_groups/test_security_groups.py
+++ b/tempest/api/compute/security_groups/test_security_groups.py
@@ -131,7 +131,6 @@
# Update security group name and description
# Create a security group
securitygroup = self.create_security_group()
- self.assertIn('id', securitygroup)
securitygroup_id = securitygroup['id']
# Update the name and description
s_new_name = data_utils.rand_name('sg-hth')
diff --git a/tempest/api/compute/security_groups/test_security_groups_negative.py b/tempest/api/compute/security_groups/test_security_groups_negative.py
index 207778a..c4dff15 100644
--- a/tempest/api/compute/security_groups/test_security_groups_negative.py
+++ b/tempest/api/compute/security_groups/test_security_groups_negative.py
@@ -154,7 +154,6 @@
def test_update_security_group_with_invalid_sg_name(self):
# Update security_group with invalid sg_name should fail
securitygroup = self.create_security_group()
- self.assertIn('id', securitygroup)
securitygroup_id = securitygroup['id']
# Update Security Group with group name longer than 255 chars
s_new_name = 'securitygroup-'.ljust(260, '0')
@@ -170,7 +169,6 @@
def test_update_security_group_with_invalid_sg_des(self):
# Update security_group with invalid sg_des should fail
securitygroup = self.create_security_group()
- self.assertIn('id', securitygroup)
securitygroup_id = securitygroup['id']
# Update Security Group with group description longer than 255 chars
s_new_des = 'des-'.ljust(260, '0')
diff --git a/tempest/api/identity/admin/v2/test_services.py b/tempest/api/identity/admin/v2/test_services.py
index 634cf21..e2ed5ef 100644
--- a/tempest/api/identity/admin/v2/test_services.py
+++ b/tempest/api/identity/admin/v2/test_services.py
@@ -41,7 +41,6 @@
self.assertIsNotNone(service_data['id'])
self.addCleanup(self._del_service, service_data['id'])
# Verifying response body of create service
- self.assertIn('id', service_data)
self.assertIn('name', service_data)
self.assertEqual(name, service_data['name'])
self.assertIn('type', service_data)
diff --git a/tempest/api/identity/admin/v3/test_domains.py b/tempest/api/identity/admin/v3/test_domains.py
index 9fe978c..bf04ede 100644
--- a/tempest/api/identity/admin/v3/test_domains.py
+++ b/tempest/api/identity/admin/v3/test_domains.py
@@ -93,7 +93,6 @@
name=d_name, description=d_desc)['domain']
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
self._delete_domain, domain['id'])
- self.assertIn('id', domain)
self.assertIn('description', domain)
self.assertIn('name', domain)
self.assertIn('enabled', domain)
@@ -147,7 +146,6 @@
d_name = data_utils.rand_name('domain')
domain = self.domains_client.create_domain(name=d_name)['domain']
self.addCleanup(self._delete_domain, domain['id'])
- self.assertIn('id', domain)
expected_data = {'name': d_name, 'enabled': True}
self.assertEqual('', domain['description'])
self.assertDictContainsSubset(expected_data, domain)
diff --git a/tempest/api/identity/admin/v3/test_endpoints.py b/tempest/api/identity/admin/v3/test_endpoints.py
index c9faa9a..5d48f68 100644
--- a/tempest/api/identity/admin/v3/test_endpoints.py
+++ b/tempest/api/identity/admin/v3/test_endpoints.py
@@ -117,7 +117,6 @@
self.setup_endpoint_ids.append(endpoint['id'])
# Asserting Create Endpoint response body
- self.assertIn('id', endpoint)
self.assertEqual(region, endpoint['region'])
self.assertEqual(url, endpoint['url'])
diff --git a/tempest/api/identity/admin/v3/test_oauth_consumers.py b/tempest/api/identity/admin/v3/test_oauth_consumers.py
index f06fb8f..970ead3 100644
--- a/tempest/api/identity/admin/v3/test_oauth_consumers.py
+++ b/tempest/api/identity/admin/v3/test_oauth_consumers.py
@@ -14,7 +14,7 @@
# under the License.
from tempest.api.identity import base
-from tempest.common.utils import data_utils
+from tempest.lib.common.utils import data_utils
from tempest.lib.common.utils import test_utils
from tempest.lib import decorators
from tempest.lib import exceptions as exceptions
diff --git a/tempest/api/identity/admin/v3/test_policies.py b/tempest/api/identity/admin/v3/test_policies.py
index 960e2cb..2908fc4 100644
--- a/tempest/api/identity/admin/v3/test_policies.py
+++ b/tempest/api/identity/admin/v3/test_policies.py
@@ -52,7 +52,6 @@
policy = self.policies_client.create_policy(blob=blob,
type=policy_type)['policy']
self.addCleanup(self._delete_policy, policy['id'])
- self.assertIn('id', policy)
self.assertIn('type', policy)
self.assertIn('blob', policy)
self.assertIsNotNone(policy['id'])
diff --git a/tempest/api/identity/admin/v3/test_services.py b/tempest/api/identity/admin/v3/test_services.py
index 20c8a44..5afeb98 100644
--- a/tempest/api/identity/admin/v3/test_services.py
+++ b/tempest/api/identity/admin/v3/test_services.py
@@ -69,7 +69,6 @@
service = self.services_client.create_service(
type=serv_type, name=name)['service']
self.addCleanup(self.services_client.delete_service, service['id'])
- self.assertIn('id', service)
expected_data = {'name': name, 'type': serv_type}
self.assertDictContainsSubset(expected_data, service)
diff --git a/tempest/api/identity/admin/v3/test_trusts.py b/tempest/api/identity/admin/v3/test_trusts.py
index 3e6a2de..850e549 100644
--- a/tempest/api/identity/admin/v3/test_trusts.py
+++ b/tempest/api/identity/admin/v3/test_trusts.py
@@ -28,12 +28,15 @@
class BaseTrustsV3Test(base.BaseIdentityV3AdminTest):
+ @classmethod
+ def skip_checks(cls):
+ super(BaseTrustsV3Test, cls).skip_checks()
+ if not CONF.identity_feature_enabled.trust:
+ raise cls.skipException("Trusts aren't enabled")
+
def setUp(self):
super(BaseTrustsV3Test, self).setUp()
# Use alt_username as the trustee
- if not CONF.identity_feature_enabled.trust:
- raise self.skipException("Trusts aren't enabled")
-
self.trust_id = None
def tearDown(self):
diff --git a/tempest/api/network/admin/test_routers_dvr.py b/tempest/api/network/admin/test_routers_dvr.py
index f9a0cfb..b6772b1 100644
--- a/tempest/api/network/admin/test_routers_dvr.py
+++ b/tempest/api/network/admin/test_routers_dvr.py
@@ -24,7 +24,8 @@
class RoutersTestDVR(base.BaseAdminNetworkTest):
@classmethod
- def resource_setup(cls):
+ def skip_checks(cls):
+ super(RoutersTestDVR, cls).skip_checks()
for ext in ['router', 'dvr']:
if not test.is_extension_enabled(ext, 'network'):
msg = "%s extension not enabled." % ext
@@ -35,6 +36,9 @@
# admin credentials to create router with distributed=True attribute
# and checking for BadRequest exception and that the resulting router
# has a distributed attribute.
+
+ @classmethod
+ def resource_setup(cls):
super(RoutersTestDVR, cls).resource_setup()
name = data_utils.rand_name('pretest-check')
router = cls.admin_routers_client.create_router(name=name)
diff --git a/tempest/api/object_storage/test_account_quotas_negative.py b/tempest/api/object_storage/test_account_quotas_negative.py
index 55a6c7a..60233b4 100644
--- a/tempest/api/object_storage/test_account_quotas_negative.py
+++ b/tempest/api/object_storage/test_account_quotas_negative.py
@@ -35,7 +35,7 @@
@classmethod
def resource_setup(cls):
super(AccountQuotasNegativeTest, cls).resource_setup()
- cls.container_name = cls.create_container()
+ cls.create_container()
# Retrieve a ResellerAdmin auth data and use it to set a quota
# on the client's account
diff --git a/tempest/api/object_storage/test_container_staticweb.py b/tempest/api/object_storage/test_container_staticweb.py
index 378061a..943011d 100644
--- a/tempest/api/object_storage/test_container_staticweb.py
+++ b/tempest/api/object_storage/test_container_staticweb.py
@@ -27,7 +27,7 @@
super(StaticWebTest, cls).resource_setup()
# This header should be posted on the container before every test
- cls.headers_public_read_acl = {'Read': '.r:*,.rlistings'}
+ headers_public_read_acl = {'Read': '.r:*,.rlistings'}
# Create test container and create one object in it
cls.container_name = cls.create_container()
@@ -36,7 +36,7 @@
cls.container_client.update_container_metadata(
cls.container_name,
- metadata=cls.headers_public_read_acl,
+ metadata=headers_public_read_acl,
metadata_prefix="X-Container-")
@classmethod
diff --git a/tempest/api/object_storage/test_object_temp_url_negative.py b/tempest/api/object_storage/test_object_temp_url_negative.py
index 3edaa86..c7d1fd5 100644
--- a/tempest/api/object_storage/test_object_temp_url_negative.py
+++ b/tempest/api/object_storage/test_object_temp_url_negative.py
@@ -65,10 +65,10 @@
# create object
self.object_name = data_utils.rand_name(name='ObjectTemp')
- self.content = data_utils.arbitrary_string(size=len(self.object_name),
- base_text=self.object_name)
+ content = data_utils.arbitrary_string(size=len(self.object_name),
+ base_text=self.object_name)
self.object_client.create_object(self.container_name,
- self.object_name, self.content)
+ self.object_name, content)
def _get_expiry_date(self, expiration_time=1000):
return int(time.time() + expiration_time)
diff --git a/tempest/api/volume/admin/test_groups.py b/tempest/api/volume/admin/test_groups.py
index 8609bdb..4c1a3eb 100644
--- a/tempest/api/volume/admin/test_groups.py
+++ b/tempest/api/volume/admin/test_groups.py
@@ -27,6 +27,11 @@
min_microversion = '3.14'
max_microversion = 'latest'
+ @classmethod
+ def setup_clients(cls):
+ super(GroupsTest, cls).setup_clients()
+ cls.volumes_client = cls.admin_volume_client
+
def _delete_group(self, grp_id, delete_volumes=True):
self.admin_groups_client.delete_group(grp_id, delete_volumes)
vols = self.admin_volume_client.list_volumes(detail=True)['volumes']
@@ -35,6 +40,21 @@
self.admin_volume_client.wait_for_resource_deletion(vol['id'])
self.admin_groups_client.wait_for_resource_deletion(grp_id)
+ def _delete_group_snapshot(self, group_snapshot_id, grp_id):
+ self.admin_group_snapshots_client.delete_group_snapshot(
+ group_snapshot_id)
+ vols = self.admin_volume_client.list_volumes(detail=True)['volumes']
+ snapshots = self.admin_snapshots_client.list_snapshots(
+ detail=True)['snapshots']
+ for vol in vols:
+ for snap in snapshots:
+ if (vol['group_id'] == grp_id and
+ vol['id'] == snap['volume_id']):
+ self.admin_snapshots_client.wait_for_resource_deletion(
+ snap['id'])
+ self.admin_group_snapshots_client.wait_for_resource_deletion(
+ group_snapshot_id)
+
@decorators.idempotent_id('4b111d28-b73d-4908-9bd2-03dc2992e4d4')
def test_group_create_show_list_delete(self):
# Create volume type
@@ -107,3 +127,62 @@
grps = self.admin_groups_client.list_groups(
detail=True)['groups']
self.assertEmpty(grps)
+
+ @decorators.idempotent_id('1298e537-f1f0-47a3-a1dd-8adec8168897')
+ def test_group_snapshot_create_show_list_delete(self):
+ # Create volume type
+ volume_type = self.create_volume_type()
+
+ # Create group type
+ group_type = self.create_group_type()
+
+ # Create group
+ grp_name = data_utils.rand_name('Group')
+ grp = self.admin_groups_client.create_group(
+ group_type=group_type['id'],
+ volume_types=[volume_type['id']],
+ name=grp_name)['group']
+ waiters.wait_for_volume_resource_status(
+ self.admin_groups_client, grp['id'], 'available')
+ self.addCleanup(self._delete_group, grp['id'])
+ self.assertEqual(grp_name, grp['name'])
+
+ # Create volume
+ vol = self.create_volume(volume_type=volume_type['id'],
+ group_id=grp['id'])
+
+ # Create group snapshot
+ group_snapshot_name = data_utils.rand_name('group_snapshot')
+ group_snapshot = (
+ self.admin_group_snapshots_client.create_group_snapshot(
+ group_id=grp['id'],
+ name=group_snapshot_name)['group_snapshot'])
+ snapshots = self.admin_snapshots_client.list_snapshots(
+ detail=True)['snapshots']
+ for snap in snapshots:
+ if vol['id'] == snap['volume_id']:
+ waiters.wait_for_volume_resource_status(
+ self.admin_snapshots_client, snap['id'], 'available')
+ waiters.wait_for_volume_resource_status(
+ self.admin_group_snapshots_client,
+ group_snapshot['id'], 'available')
+ self.assertEqual(group_snapshot_name, group_snapshot['name'])
+
+ # Get a given group snapshot
+ group_snapshot = self.admin_group_snapshots_client.show_group_snapshot(
+ group_snapshot['id'])['group_snapshot']
+ self.assertEqual(group_snapshot_name, group_snapshot['name'])
+
+ # Get all group snapshots with detail
+ group_snapshots = (
+ self.admin_group_snapshots_client.list_group_snapshots(
+ detail=True)['group_snapshots'])
+ self.assertIn((group_snapshot['name'], group_snapshot['id']),
+ [(m['name'], m['id']) for m in group_snapshots])
+
+ # Delete group snapshot
+ self._delete_group_snapshot(group_snapshot['id'], grp['id'])
+ group_snapshots = (
+ self.admin_group_snapshots_client.list_group_snapshots(
+ detail=True)['group_snapshots'])
+ self.assertEmpty(group_snapshots)
diff --git a/tempest/api/volume/base.py b/tempest/api/volume/base.py
index ef69ba3..9142dc3 100644
--- a/tempest/api/volume/base.py
+++ b/tempest/api/volume/base.py
@@ -85,6 +85,7 @@
cls.messages_client = cls.os_primary.volume_v3_messages_client
cls.versions_client = cls.os_primary.volume_v3_versions_client
cls.groups_client = cls.os_primary.groups_v3_client
+ cls.group_snapshots_client = cls.os_primary.group_snapshots_v3_client
def setUp(self):
super(BaseVolumeTest, self).setUp()
@@ -275,6 +276,8 @@
cls.os_admin.volume_scheduler_stats_v2_client
cls.admin_messages_client = cls.os_admin.volume_v3_messages_client
cls.admin_groups_client = cls.os_admin.groups_v3_client
+ cls.admin_group_snapshots_client = \
+ cls.os_admin.group_snapshots_v3_client
cls.admin_group_types_client = cls.os_admin.group_types_v3_client
@classmethod
diff --git a/tempest/clients.py b/tempest/clients.py
index 85c2242..d7a52d1 100644
--- a/tempest/clients.py
+++ b/tempest/clients.py
@@ -268,6 +268,9 @@
self.backups_v3_client = self.volume_v3.BackupsClient()
self.group_types_v3_client = self.volume_v3.GroupTypesClient()
self.groups_v3_client = self.volume_v3.GroupsClient()
+ self.group_snapshots_v3_client = \
+ self.volume_v3.GroupSnapshotsClient()
+ self.snapshots_v3_client = self.volume_v3.SnapshotsClient()
self.volume_v3_messages_client = self.volume_v3.MessagesClient()
self.volume_v3_versions_client = self.volume_v3.VersionsClient()
self.volumes_v3_client = self.volume_v3.VolumesClient()
diff --git a/tempest/common/credentials_factory.py b/tempest/common/credentials_factory.py
index fd875be..5dc1a3e 100644
--- a/tempest/common/credentials_factory.py
+++ b/tempest/common/credentials_factory.py
@@ -63,7 +63,7 @@
:param identity_version: 'v2' or 'v3'
:param admin_creds: An object of type `auth.Credentials`. If None, it
is built from the configuration file as well.
- :returns A dict with the parameters
+ :return: A dict with the parameters
"""
_common_params = _get_common_provider_params(identity_version)
admin_creds = admin_creds or get_configured_admin_credentials(
@@ -96,7 +96,7 @@
Parameters that are not configuration specific (name) are not returned.
:param identity_version: 'v2' or 'v3'
- :returns A dict with the parameters
+ :return: A dict with the parameters
"""
_common_params = _get_common_provider_params(identity_version)
reseller_admin_role = CONF.object_storage.reseller_admin_role
diff --git a/tempest/common/waiters.py b/tempest/common/waiters.py
index cf187e6..f4c2866 100644
--- a/tempest/common/waiters.py
+++ b/tempest/common/waiters.py
@@ -188,8 +188,9 @@
"""
if not isinstance(statuses, list):
statuses = [statuses]
- resource_name = re.findall(r'(Volume|Snapshot|Backup|Group)',
- client.__class__.__name__)[0].lower()
+ resource_name = re.findall(
+ r'(volume|group-snapshot|snapshot|backup|group)',
+ client.resource_type)[-1].replace('-', '_')
show_resource = getattr(client, 'show_' + resource_name)
resource_status = show_resource(resource_id)[resource_name]['status']
start = int(time.time())
diff --git a/tempest/lib/exceptions.py b/tempest/lib/exceptions.py
index cdb8be9..c538c72 100644
--- a/tempest/lib/exceptions.py
+++ b/tempest/lib/exceptions.py
@@ -44,6 +44,9 @@
def __str__(self):
return self._error_string
+ def __repr__(self):
+ return self._error_string
+
class RestClientException(TempestException,
testtools.TestCase.failureException):
diff --git a/tempest/lib/services/clients.py b/tempest/lib/services/clients.py
index 5f230b7..4fa7a7a 100644
--- a/tempest/lib/services/clients.py
+++ b/tempest/lib/services/clients.py
@@ -17,10 +17,12 @@
import copy
import importlib
import inspect
+import sys
import warnings
from debtcollector import removals
from oslo_log import log as logging
+import testtools
from tempest.lib import auth
from tempest.lib.common.utils import misc
@@ -85,6 +87,7 @@
extra_service_versions = set([])
_tempest_modules = set(tempest_modules())
plugin_services = ClientsRegistry().get_service_clients()
+ name_conflicts = []
for plugin_name in plugin_services:
plug_service_versions = set([x['service_version'] for x in
plugin_services[plugin_name]])
@@ -96,8 +99,8 @@
'claimed by another one' % (plugin_name,
extra_service_versions &
plug_service_versions))
- raise exceptions.PluginRegistrationException(
- name=plugin_name, detailed_error=detailed_error)
+ name_conflicts.append(exceptions.PluginRegistrationException(
+ name=plugin_name, detailed_error=detailed_error))
# NOTE(andreaf) Once all tempest clients are stable, the following
# if will have to be removed.
if not plug_service_versions.isdisjoint(
@@ -107,9 +110,14 @@
'claimed by a Tempest one' % (plugin_name,
_tempest_internal_modules() &
plug_service_versions))
- raise exceptions.PluginRegistrationException(
- name=plugin_name, detailed_error=detailed_error)
+ name_conflicts.append(exceptions.PluginRegistrationException(
+ name=plugin_name, detailed_error=detailed_error))
extra_service_versions |= plug_service_versions
+ if name_conflicts:
+ LOG.error(
+ 'Failed to list available modules due to name conflicts: %s',
+ name_conflicts)
+ raise testtools.MultipleExceptions(*name_conflicts)
return _tempest_modules | extra_service_versions
@@ -375,6 +383,7 @@
# Register service clients from the registry (__tempest__ and plugins)
clients_registry = ClientsRegistry()
plugin_service_clients = clients_registry.get_service_clients()
+ registration_errors = []
for plugin in plugin_service_clients:
service_clients = plugin_service_clients[plugin]
# Each plugin returns a list of service client parameters
@@ -385,10 +394,12 @@
try:
self.register_service_client_module(**service_client)
except Exception:
+ registration_errors.append(sys.exc_info())
LOG.exception(
'Failed to register service client from plugin %s '
'with parameters %s', plugin, service_client)
- raise
+ if registration_errors:
+ raise testtools.MultipleExceptions(*registration_errors)
def register_service_client_module(self, name, service_version,
module_path, client_names, **kwargs):
diff --git a/tempest/lib/services/volume/v1/backups_client.py b/tempest/lib/services/volume/v1/backups_client.py
index 8677913..77c40b3 100644
--- a/tempest/lib/services/volume/v1/backups_client.py
+++ b/tempest/lib/services/volume/v1/backups_client.py
@@ -102,3 +102,8 @@
except lib_exc.NotFound:
return True
return False
+
+ @property
+ def resource_type(self):
+ """Returns the primary type of resource this client works with."""
+ return 'backup'
diff --git a/tempest/lib/services/volume/v2/backups_client.py b/tempest/lib/services/volume/v2/backups_client.py
index 830fb82..adfa6a6 100644
--- a/tempest/lib/services/volume/v2/backups_client.py
+++ b/tempest/lib/services/volume/v2/backups_client.py
@@ -112,3 +112,8 @@
except lib_exc.NotFound:
return True
return False
+
+ @property
+ def resource_type(self):
+ """Returns the primary type of resource this client works with."""
+ return 'backup'
diff --git a/tempest/lib/services/volume/v3/__init__.py b/tempest/lib/services/volume/v3/__init__.py
index ff58fc2..2d85553 100644
--- a/tempest/lib/services/volume/v3/__init__.py
+++ b/tempest/lib/services/volume/v3/__init__.py
@@ -14,11 +14,16 @@
from tempest.lib.services.volume.v3.backups_client import BackupsClient
from tempest.lib.services.volume.v3.base_client import BaseClient
+from tempest.lib.services.volume.v3.group_snapshots_client import \
+ GroupSnapshotsClient
from tempest.lib.services.volume.v3.group_types_client import GroupTypesClient
from tempest.lib.services.volume.v3.groups_client import GroupsClient
from tempest.lib.services.volume.v3.messages_client import MessagesClient
+from tempest.lib.services.volume.v3.snapshots_client import SnapshotsClient
from tempest.lib.services.volume.v3.versions_client import VersionsClient
from tempest.lib.services.volume.v3.volumes_client import VolumesClient
-__all__ = ['BackupsClient', 'BaseClient', 'GroupsClient', 'GroupTypesClient',
- 'MessagesClient', 'VersionsClient', 'VolumesClient']
+__all__ = ['BackupsClient', 'BaseClient', 'GroupsClient',
+ 'GroupSnapshotsClient', 'GroupTypesClient',
+ 'MessagesClient', 'SnapshotsClient', 'VersionsClient',
+ 'VolumesClient']
diff --git a/tempest/lib/services/volume/v3/group_snapshots_client.py b/tempest/lib/services/volume/v3/group_snapshots_client.py
new file mode 100644
index 0000000..e644f02
--- /dev/null
+++ b/tempest/lib/services/volume/v3/group_snapshots_client.py
@@ -0,0 +1,88 @@
+# Copyright (C) 2017 Dell Inc. or its subsidiaries.
+# All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from oslo_serialization import jsonutils as json
+from six.moves.urllib import parse as urllib
+
+from tempest.lib.common import rest_client
+from tempest.lib import exceptions as lib_exc
+from tempest.lib.services.volume import base_client
+
+
+class GroupSnapshotsClient(base_client.BaseClient):
+ """Client class to send CRUD Volume Group Snapshot API requests"""
+ api_version = 'v3'
+
+ def create_group_snapshot(self, **kwargs):
+ """Creates a group snapshot.
+
+ For a full list of available parameters, please refer to the official
+ API reference:
+ https://developer.openstack.org/api-ref/block-storage/v3/#create-group-snapshot
+ """
+ post_body = json.dumps({'group_snapshot': kwargs})
+ resp, body = self.post('group_snapshots', post_body)
+ body = json.loads(body)
+ self.expected_success(202, resp.status)
+ return rest_client.ResponseBody(resp, body)
+
+ def delete_group_snapshot(self, group_snapshot_id):
+ """Deletes a group snapshot.
+
+ For more information, please refer to the official API reference:
+ https://developer.openstack.org/api-ref/block-storage/v3/#delete-group-snapshot
+ """
+ resp, body = self.delete('group_snapshots/%s' % group_snapshot_id)
+ self.expected_success(202, resp.status)
+ return rest_client.ResponseBody(resp, body)
+
+ def show_group_snapshot(self, group_snapshot_id):
+ """Returns the details of a single group snapshot.
+
+ For more information, please refer to the official API reference:
+ https://developer.openstack.org/api-ref/block-storage/v3/#show-group-snapshot-details
+ """
+ url = "group_snapshots/%s" % str(group_snapshot_id)
+ resp, body = self.get(url)
+ body = json.loads(body)
+ self.expected_success(200, resp.status)
+ return rest_client.ResponseBody(resp, body)
+
+ def list_group_snapshots(self, **params):
+ """Information for all the tenant's group snapshots.
+
+ For more information, please refer to the official API reference:
+ https://developer.openstack.org/api-ref/block-storage/v3/#list-group-snapshots
+ https://developer.openstack.org/api-ref/block-storage/v3/#list-group-snapshots-with-details
+ """
+ url = "group_snapshots"
+ if params:
+ url += '?%s' % urllib.urlencode(params)
+ resp, body = self.get(url)
+ body = json.loads(body)
+ self.expected_success(200, resp.status)
+ return rest_client.ResponseBody(resp, body)
+
+ def is_resource_deleted(self, id):
+ try:
+ self.show_group_snapshot(id)
+ except lib_exc.NotFound:
+ return True
+ return False
+
+ @property
+ def resource_type(self):
+ """Returns the primary type of resource this client works with."""
+ return 'group-snapshot'
diff --git a/tempest/lib/services/volume/v3/snapshots_client.py b/tempest/lib/services/volume/v3/snapshots_client.py
new file mode 100644
index 0000000..88c094f
--- /dev/null
+++ b/tempest/lib/services/volume/v3/snapshots_client.py
@@ -0,0 +1,21 @@
+# Copyright (C) 2017 Dell Inc. or its subsidiaries.
+# All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from tempest.lib.services.volume.v2 import snapshots_client
+
+
+class SnapshotsClient(snapshots_client.SnapshotsClient):
+ """Client class to send CRUD Volume Snapshot V3 API requests."""
+ api_version = "v3"
diff --git a/tempest/tests/common/test_waiters.py b/tempest/tests/common/test_waiters.py
index c2f622c..bc197b5 100644
--- a/tempest/tests/common/test_waiters.py
+++ b/tempest/tests/common/test_waiters.py
@@ -59,6 +59,7 @@
# Tests that the wait method raises VolumeRestoreErrorException if
# the volume status is 'error_restoring'.
client = mock.Mock(spec=volumes_client.VolumesClient,
+ resource_type="volume",
build_interval=1)
volume1 = {'volume': {'status': 'restoring-backup'}}
volume2 = {'volume': {'status': 'error_restoring'}}
diff --git a/tempest/tests/lib/services/test_clients.py b/tempest/tests/lib/services/test_clients.py
index a837199..6d0f27a 100644
--- a/tempest/tests/lib/services/test_clients.py
+++ b/tempest/tests/lib/services/test_clients.py
@@ -16,6 +16,7 @@
import fixtures
import mock
+import six
import testtools
from tempest.lib import auth
@@ -258,6 +259,58 @@
clients.ServiceClients(creds, identity_uri=uri,
client_parameters=params)
+ def test___init___plugin_service_clients_cannot_load(self):
+ creds = fake_credentials.FakeKeystoneV3Credentials()
+ uri = 'fake_uri'
+ fake_service_clients = {
+ 'service1': [{'name': 'client1',
+ 'service_version': 'client1.v1',
+ 'module_path': 'I cannot load this',
+ 'client_names': ['SomeClient1']}],
+ 'service2': [{'name': 'client2',
+ 'service_version': 'client2.v1',
+ 'module_path': 'This neither',
+ 'client_names': ['SomeClient1']}]}
+ msg = "(?=.*{0})(?=.*{1})".format(
+ *[x[1][0]['module_path'] for x in six.iteritems(
+ fake_service_clients)])
+ self.useFixture(fixtures.MockPatchObject(
+ clients.ClientsRegistry(), 'get_service_clients',
+ return_value=fake_service_clients))
+ with testtools.ExpectedException(
+ testtools.MultipleExceptions, value_re=msg):
+ clients.ServiceClients(creds, identity_uri=uri)
+
+ def test___init___plugin_service_clients_name_conflict(self):
+ creds = fake_credentials.FakeKeystoneV3Credentials()
+ uri = 'fake_uri'
+ fake_service_clients = {
+ 'serviceA': [{'name': 'client1',
+ 'service_version': 'client1.v1',
+ 'module_path': 'fake_path_1',
+ 'client_names': ['SomeClient1']}],
+ 'serviceB': [{'name': 'client1',
+ 'service_version': 'client1.v2',
+ 'module_path': 'fake_path_2',
+ 'client_names': ['SomeClient2']}],
+ 'serviceC': [{'name': 'client1',
+ 'service_version': 'client1.v1',
+ 'module_path': 'fake_path_2',
+ 'client_names': ['SomeClient1']}],
+ 'serviceD': [{'name': 'client1',
+ 'service_version': 'client1.v2',
+ 'module_path': 'fake_path_2',
+ 'client_names': ['SomeClient2']}]}
+ msg = "(?=.*{0})(?=.*{1})".format(
+ *[x[1][0]['service_version'] for x in six.iteritems(
+ fake_service_clients)])
+ self.useFixture(fixtures.MockPatchObject(
+ clients.ClientsRegistry(), 'get_service_clients',
+ return_value=fake_service_clients))
+ with testtools.ExpectedException(
+ testtools.MultipleExceptions, value_re=msg):
+ clients.ServiceClients(creds, identity_uri=uri)
+
def _get_manager(self, init_region='fake_region'):
# Get a manager to invoke _setup_parameters on
creds = fake_credentials.FakeKeystoneV2Credentials()
diff --git a/tempest/tests/lib/services/volume/v3/test_group_snapshots_client.py b/tempest/tests/lib/services/volume/v3/test_group_snapshots_client.py
new file mode 100644
index 0000000..5ac5c08
--- /dev/null
+++ b/tempest/tests/lib/services/volume/v3/test_group_snapshots_client.py
@@ -0,0 +1,141 @@
+# Copyright (C) 2017 Dell Inc. or its subsidiaries.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from tempest.lib.services.volume.v3 import group_snapshots_client
+from tempest.tests.lib import fake_auth_provider
+from tempest.tests.lib.services import base
+
+
+class TestGroupSnapshotsClient(base.BaseServiceTest):
+ FAKE_CREATE_GROUP_SNAPSHOT = {
+ "group_snapshot": {
+ "group_id": "49c8c114-0d68-4e89-b8bc-3f5a674d54be",
+ "name": "group-snapshot-001",
+ "description": "Test group snapshot 1"
+ }
+ }
+
+ FAKE_INFO_GROUP_SNAPSHOT = {
+ "group_snapshot": {
+ "id": "0e701ab8-1bec-4b9f-b026-a7ba4af13578",
+ "group_id": "49c8c114-0d68-4e89-b8bc-3f5a674d54be",
+ "name": "group-snapshot-001",
+ "description": "Test group snapshot 1",
+ "group_type_id": "0e58433f-d108-4bf3-a22c-34e6b71ef86b",
+ "status": "available",
+ "created_at": "20127-06-20T03:50:07Z"
+ }
+ }
+
+ FAKE_LIST_GROUP_SNAPSHOTS = {
+ "group_snapshots": [
+ {
+ "id": "0e701ab8-1bec-4b9f-b026-a7ba4af13578",
+ "group_id": "49c8c114-0d68-4e89-b8bc-3f5a674d54be",
+ "name": "group-snapshot-001",
+ "description": "Test group snapshot 1",
+ "group_type_id": "0e58433f-d108-4bf3-a22c-34e6b71ef86b",
+ "status": "available",
+ "created_at": "2017-06-20T03:50:07Z",
+ },
+ {
+ "id": "e479997c-650b-40a4-9dfe-77655818b0d2",
+ "group_id": "49c8c114-0d68-4e89-b8bc-3f5a674d54be",
+ "name": "group-snapshot-002",
+ "description": "Test group snapshot 2",
+ "group_type_id": "0e58433f-d108-4bf3-a22c-34e6b71ef86b",
+ "status": "available",
+ "created_at": "2017-06-19T01:52:47Z",
+ },
+ {
+ "id": "c5c4769e-213c-40a6-a568-8e797bb691d4",
+ "group_id": "49c8c114-0d68-4e89-b8bc-3f5a674d54be",
+ "name": "group-snapshot-003",
+ "description": "Test group snapshot 3",
+ "group_type_id": "0e58433f-d108-4bf3-a22c-34e6b71ef86b",
+ "status": "available",
+ "created_at": "2017-06-18T06:34:32Z",
+ }
+ ]
+ }
+
+ def setUp(self):
+ super(TestGroupSnapshotsClient, self).setUp()
+ fake_auth = fake_auth_provider.FakeAuthProvider()
+ self.client = group_snapshots_client.GroupSnapshotsClient(
+ fake_auth, 'volume', 'regionOne')
+
+ def _test_create_group_snapshot(self, bytes_body=False):
+ self.check_service_client_function(
+ self.client.create_group_snapshot,
+ 'tempest.lib.common.rest_client.RestClient.post',
+ self.FAKE_CREATE_GROUP_SNAPSHOT,
+ bytes_body,
+ group_id="49c8c114-0d68-4e89-b8bc-3f5a674d54be",
+ status=202)
+
+ def _test_show_group_snapshot(self, bytes_body=False):
+ self.check_service_client_function(
+ self.client.show_group_snapshot,
+ 'tempest.lib.common.rest_client.RestClient.get',
+ self.FAKE_INFO_GROUP_SNAPSHOT,
+ bytes_body,
+ group_snapshot_id="3fbbcccf-d058-4502-8844-6feeffdf4cb5")
+
+ def _test_list_group_snapshots(self, bytes_body=False, detail=False):
+ resp_body = []
+ if detail:
+ resp_body = self.FAKE_LIST_GROUP_SNAPSHOTS
+ else:
+ resp_body = {
+ 'group_snapshots': [{
+ 'id': group_snapshot['id'],
+ 'name': group_snapshot['name'],
+ 'group_type_id': group_snapshot['group_type_id']}
+ for group_snapshot in
+ self.FAKE_LIST_GROUP_SNAPSHOTS['group_snapshots']
+ ]
+ }
+ self.check_service_client_function(
+ self.client.list_group_snapshots,
+ 'tempest.lib.common.rest_client.RestClient.get',
+ resp_body,
+ bytes_body,
+ detail=detail)
+
+ def test_create_group_snapshot_with_str_body(self):
+ self._test_create_group_snapshot()
+
+ def test_create_group_snapshot_with_bytes_body(self):
+ self._test_create_group_snapshot(bytes_body=True)
+
+ def test_show_group_snapshot_with_str_body(self):
+ self._test_show_group_snapshot()
+
+ def test_show_group_snapshot_with_bytes_body(self):
+ self._test_show_group_snapshot(bytes_body=True)
+
+ def test_list_group_snapshots_with_str_body(self):
+ self._test_list_group_snapshots()
+
+ def test_list_group_snapshots_with_bytes_body(self):
+ self._test_list_group_snapshots(bytes_body=True)
+
+ def test_delete_group_snapshot(self):
+ self.check_service_client_function(
+ self.client.delete_group_snapshot,
+ 'tempest.lib.common.rest_client.RestClient.delete',
+ {},
+ group_snapshot_id='0e701ab8-1bec-4b9f-b026-a7ba4af13578',
+ status=202)
diff --git a/test-requirements.txt b/test-requirements.txt
index 6a5ea03..09c7685 100644
--- a/test-requirements.txt
+++ b/test-requirements.txt
@@ -4,7 +4,7 @@
hacking!=0.13.0,<0.14,>=0.12.0 # Apache-2.0
# needed for doc build
sphinx>=1.6.2 # BSD
-openstackdocstheme>=1.11.0 # Apache-2.0
+openstackdocstheme>=1.16.0 # Apache-2.0
reno!=2.3.1,>=1.8.0 # Apache-2.0
mock>=2.0 # BSD
coverage!=4.4,>=4.0 # Apache-2.0