Initial layout of Designate tempest plugin
See https://review.openstack.org/283511 for history.
Change-Id: I7733e8786d6b525a7c9a8d4f12add329cd030d9d
Partially-Implements: blueprint designate-tempest-plugin
diff --git a/designate_tempest_plugin/__init__.py b/designate_tempest_plugin/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/designate_tempest_plugin/__init__.py
diff --git a/designate_tempest_plugin/clients.py b/designate_tempest_plugin/clients.py
new file mode 100644
index 0000000..79d6cba
--- /dev/null
+++ b/designate_tempest_plugin/clients.py
@@ -0,0 +1,37 @@
+# Copyright 2016 Hewlett Packard Enterprise Development Company, L.P.
+#
+# 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 import clients
+from tempest import config
+
+from designate_tempest_plugin.services.dns.v2.json.zones_client import \
+ ZonesClient
+
+
+CONF = config.CONF
+
+
+class Manager(clients.Manager):
+ def __init__(self, credentials=None, service=None):
+ super(Manager, self).__init__(credentials, service)
+
+ params = {
+ 'service': CONF.dns.catalog_type,
+ 'region': CONF.identity.region,
+ 'endpoint_type': CONF.dns.endpoint_type,
+ 'build_interval': CONF.dns.build_interval,
+ 'build_timeout': CONF.dns.build_timeout
+ }
+ params.update(self.default_params)
+
+ self.zones_client = ZonesClient(self.auth_provider, **params)
diff --git a/designate_tempest_plugin/common/__init__.py b/designate_tempest_plugin/common/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/designate_tempest_plugin/common/__init__.py
diff --git a/designate_tempest_plugin/common/waiters.py b/designate_tempest_plugin/common/waiters.py
new file mode 100644
index 0000000..a75870b
--- /dev/null
+++ b/designate_tempest_plugin/common/waiters.py
@@ -0,0 +1,83 @@
+# Copyright 2016 Hewlett Packard Enterprise Development Company, L.P.
+#
+# 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.
+
+import time
+
+from oslo_log import log as logging
+from tempest.lib.common.utils import misc as misc_utils
+from tempest.lib import exceptions as lib_exc
+
+LOG = logging.getLogger(__name__)
+
+
+def wait_for_zone_404(client, zone_id):
+ """Waits for a zone to 404."""
+ LOG.info('Waiting for zone %s to 404', zone_id)
+ start = int(time.time())
+
+ while True:
+ time.sleep(client.build_interval)
+
+ try:
+ _, zone = client.show_zone(zone_id)
+ except lib_exc.NotFound:
+ LOG.info('Zone %s is 404ing', zone_id)
+ return
+
+ if int(time.time()) - start >= client.build_timeout:
+ message = ('Zone %(zone_id)s failed to 404 within the required '
+ 'time (%(timeout)s s). Current status: '
+ '%(status_curr)s' %
+ {'zone_id': zone_id,
+ 'status_curr': zone['status'],
+ 'timeout': client.build_timeout})
+
+ caller = misc_utils.find_test_caller()
+
+ if caller:
+ message = '(%s) %s' % (caller, message)
+
+ raise lib_exc.TimeoutException(message)
+
+
+def wait_for_zone_status(client, zone_id, status):
+ """Waits for a zone to reach given status."""
+ LOG.info('Waiting for zone %s to reach %s', zone_id, status)
+
+ _, zone = client.show_zone(zone_id)
+ start = int(time.time())
+
+ while zone['status'] != status:
+ time.sleep(client.build_interval)
+ _, zone = client.show_zone(zone_id)
+ status_curr = zone['status']
+ if status_curr == status:
+ LOG.info('Zone %s reached %s', zone_id, status)
+ return
+
+ if int(time.time()) - start >= client.build_timeout:
+ message = ('Zone %(zone_id)s failed to reach status=%(status)s '
+ 'within the required time (%(timeout)s s). Current '
+ 'status: %(status_curr)s' %
+ {'zone_id': zone_id,
+ 'status': status,
+ 'status_curr': status_curr,
+ 'timeout': client.build_timeout})
+
+ caller = misc_utils.find_test_caller()
+
+ if caller:
+ message = '(%s) %s' % (caller, message)
+
+ raise lib_exc.TimeoutException(message)
diff --git a/designate_tempest_plugin/config.py b/designate_tempest_plugin/config.py
new file mode 100644
index 0000000..4094149
--- /dev/null
+++ b/designate_tempest_plugin/config.py
@@ -0,0 +1,34 @@
+# Copyright 2016 Hewlett Packard Enterprise Development Company, L.P.
+#
+# 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_config import cfg
+
+dns_group = cfg.OptGroup(name='dns',
+ title='DNS service options')
+
+DnsGroup = [
+ cfg.StrOpt('endpoint_type',
+ default='publicURL',
+ choices=['public', 'admin', 'internal',
+ 'publicURL', 'adminURL', 'internalURL'],
+ help="The endpoint type to use for the DNS service"),
+ cfg.StrOpt('catalog_type',
+ default='dns',
+ help="Catalog type of the DNS service"),
+ cfg.IntOpt('build_interval',
+ default=1,
+ help="Time in seconds between build status checks."),
+ cfg.IntOpt('build_timeout',
+ default=60,
+ help="Timeout in seconds to wait for an resource to build."),
+]
diff --git a/designate_tempest_plugin/data_utils.py b/designate_tempest_plugin/data_utils.py
new file mode 100644
index 0000000..73207d5
--- /dev/null
+++ b/designate_tempest_plugin/data_utils.py
@@ -0,0 +1,39 @@
+# Copyright 2016 Hewlett Packard Enterprise Development Company, L.P.
+#
+# 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.common.utils import data_utils
+
+
+def rand_zone_name():
+ """Generate a random zone name
+ :return: a random zone name e.g. example.org.
+ :rtype: string
+ """
+ return '%s.com.' % data_utils.rand_name()
+
+
+def rand_email(domain=None):
+ """Generate a random zone name
+ :return: a random zone name e.g. example.org.
+ :rtype: string
+ """
+ domain = domain or rand_zone_name()
+ return 'example@%s' % domain.rstrip('.')
+
+
+def rand_ttl(start=1, end=86400):
+ """Generate a random TTL value
+ :return: a random ttl e.g. 165
+ :rtype: string
+ """
+ return data_utils.rand_int_id(start, end)
diff --git a/designate_tempest_plugin/plugin.py b/designate_tempest_plugin/plugin.py
new file mode 100644
index 0000000..20f19c1
--- /dev/null
+++ b/designate_tempest_plugin/plugin.py
@@ -0,0 +1,66 @@
+# Copyright 2016 NEC Corporation. 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.
+
+import os
+
+from tempest import config
+from tempest.test_discover import plugins
+
+from designate_tempest_plugin import config as project_config
+
+
+class DesignateTempestPlugin(plugins.TempestPlugin):
+ """
+ A DesignateTempestPlugin class provides the basic hooks for an external
+ plugin to provide tempest the necessary information to run the plugin.
+ """
+ def load_tests(self):
+ """
+ Method to return the information necessary to load the tests in the
+ plugin.
+
+ :return: a tuple with the first value being the test_dir and the second
+ being the top_level
+ :return type: tuple
+ """
+ base_path = os.path.split(os.path.dirname(
+ os.path.abspath(__file__)))[0]
+ test_dir = "designate_tempest_plugin/tests"
+ full_test_dir = os.path.join(base_path, test_dir)
+ return full_test_dir, base_path
+
+ def register_opts(self, conf):
+ """
+ Add additional configuration options to tempest.
+
+ This method will be run for the plugin during the register_opts()
+ function in tempest.config
+
+ Parameters:
+ conf (ConfigOpts): The conf object that can be used to register
+ additional options on.
+ """
+ config.register_opt_group(conf, project_config.dns_group,
+ project_config.DnsGroup)
+
+ def get_opt_lists(self):
+ """
+ Get a list of options for sample config generation
+
+ Return option_list: A list of tuples with the group name
+ and options in that group.
+ Return type: list
+ """
+ return [(project_config.dns_group.name,
+ project_config.DnsGroup)]
diff --git a/designate_tempest_plugin/services/__init__.py b/designate_tempest_plugin/services/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/designate_tempest_plugin/services/__init__.py
diff --git a/designate_tempest_plugin/services/dns/__init__.py b/designate_tempest_plugin/services/dns/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/designate_tempest_plugin/services/dns/__init__.py
diff --git a/designate_tempest_plugin/services/dns/json/__init__.py b/designate_tempest_plugin/services/dns/json/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/designate_tempest_plugin/services/dns/json/__init__.py
diff --git a/designate_tempest_plugin/services/dns/json/base.py b/designate_tempest_plugin/services/dns/json/base.py
new file mode 100644
index 0000000..f2574d6
--- /dev/null
+++ b/designate_tempest_plugin/services/dns/json/base.py
@@ -0,0 +1,119 @@
+# Copyright 2016 Hewlett Packard Enterprise Development Company, L.P.
+#
+# 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.
+import functools
+
+from oslo_log import log as logging
+from oslo_serialization import jsonutils as json
+from tempest.lib.common import rest_client
+from six.moves.urllib import parse as urllib
+
+
+LOG = logging.getLogger(__name__)
+
+
+def handle_errors(f):
+ """A decorator that allows to ignore certain types of errors."""
+
+ @functools.wraps(f)
+ def wrapper(*args, **kwargs):
+ param_name = 'ignore_errors'
+ ignored_errors = kwargs.get(param_name, tuple())
+
+ if param_name in kwargs:
+ del kwargs[param_name]
+
+ try:
+ return f(*args, **kwargs)
+ except ignored_errors as e:
+ # Silently ignore errors as requested
+ LOG.debug('Ignoring exception of type %s, as requested', type(e))
+
+ return wrapper
+
+
+class DnsClientBase(rest_client.RestClient):
+ """Base Tempest REST client for Designate API"""
+
+ uri_prefix = ''
+
+ def serialize(self, object_dict):
+ return json.dumps(object_dict)
+
+ def deserialize(self, object_str):
+ return json.loads(object_str)
+
+ def _get_uri(self, resource_name, uuid=None, params=None):
+ """Get URI for a specific resource or object.
+ :param resource_name: The name of the REST resource, e.g., 'zones'.
+ :param uuid: The unique identifier of an object in UUID format.
+ :param params: A Python dict that represents the query paramaters to
+ include in the request URI.
+ :returns: Relative URI for the resource or object.
+ """
+ uri_pattern = '{pref}/{res}{uuid}{params}'
+
+ uuid = '/%s' % uuid if uuid else ''
+ params = '?%s' % urllib.urlencode(params) if params else ''
+
+ return uri_pattern.format(pref=self.uri_prefix,
+ res=resource_name,
+ uuid=uuid,
+ params=params)
+
+ def _create_request(self, resource, object_dict, params=None):
+ """Create an object of the specified type.
+ :param resource: The name of the REST resource, e.g., 'zones'.
+ :param object_dict: A Python dict that represents an object of the
+ specified type.
+ :param params: A Python dict that represents the query paramaters to
+ include in the request URI.
+ :returns: A tuple with the server response and the deserialized created
+ object.
+ """
+ body = self.serialize(object_dict)
+ uri = self._get_uri(resource, params=params)
+
+ resp, body = self.post(uri, body=body)
+ self.expected_success([201, 202], resp['status'])
+
+ return resp, self.deserialize(body)
+
+ def _show_request(self, resource, uuid, params=None):
+ """Gets a specific object of the specified type.
+ :param uuid: Unique identifier of the object in UUID format.
+ :param params: A Python dict that represents the query paramaters to
+ include in the request URI.
+ :returns: Serialized object as a dictionary.
+ """
+ uri = self._get_uri(resource, uuid=uuid, params=params)
+
+ resp, body = self.get(uri)
+
+ self.expected_success(200, resp['status'])
+
+ return resp, self.deserialize(body)
+
+ def _delete_request(self, resource, uuid, params=None):
+ """Delete specified object.
+ :param resource: The name of the REST resource, e.g., 'zones'.
+ :param uuid: The unique identifier of an object in UUID format.
+ :param params: A Python dict that represents the query paramaters to
+ include in the request URI.
+ :returns: A tuple with the server response and the response body.
+ """
+ uri = self._get_uri(resource, uuid=uuid, params=params)
+
+ resp, body = self.delete(uri)
+ self.expected_success([202, 204], resp['status'])
+ return resp, self.deserialize(body)
diff --git a/designate_tempest_plugin/services/dns/v2/__init__.py b/designate_tempest_plugin/services/dns/v2/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/designate_tempest_plugin/services/dns/v2/__init__.py
diff --git a/designate_tempest_plugin/services/dns/v2/json/__init__.py b/designate_tempest_plugin/services/dns/v2/json/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/designate_tempest_plugin/services/dns/v2/json/__init__.py
diff --git a/designate_tempest_plugin/services/dns/v2/json/base.py b/designate_tempest_plugin/services/dns/v2/json/base.py
new file mode 100644
index 0000000..a679fd6
--- /dev/null
+++ b/designate_tempest_plugin/services/dns/v2/json/base.py
@@ -0,0 +1,21 @@
+# Copyright 2016 Hewlett Packard Enterprise Development Company, L.P.
+#
+# 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 designate_tempest_plugin.services.dns.json import base
+
+handle_errors = base.handle_errors
+
+
+class DnsClientV2Base(base.DnsClientBase):
+ """Base API V2 Tempest REST client for Designate API"""
+ uri_prefix = 'v2'
diff --git a/designate_tempest_plugin/services/dns/v2/json/zones_client.py b/designate_tempest_plugin/services/dns/v2/json/zones_client.py
new file mode 100644
index 0000000..6f5cb95
--- /dev/null
+++ b/designate_tempest_plugin/services/dns/v2/json/zones_client.py
@@ -0,0 +1,74 @@
+# Copyright 2016 Hewlett Packard Enterprise Development Company, L.P.
+#
+# 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.common.utils import data_utils
+
+from designate_tempest_plugin import data_utils as dns_data_utils
+from designate_tempest_plugin.common import waiters
+from designate_tempest_plugin.services.dns.v2.json import base
+
+
+class ZonesClient(base.DnsClientV2Base):
+ """API V2 Tempest REST client for Designate API"""
+
+ @base.handle_errors
+ def create_zone(self, name=None, email=None, ttl=None, description=None,
+ wait_until=False, params=None):
+ """Create a zone with the specified parameters.
+
+ :param name: The name of the zone.
+ Default: Random Value
+ :param email: The email for the zone.
+ Default: Random Value
+ :param ttl: The ttl for the zone.
+ Default: Random Value
+ :param description: A description of the zone.
+ Default: Random Value
+ :param wait_until: Block until the zone reaches the desiered status
+ :param params: A Python dict that represents the query paramaters to
+ include in the request URI.
+ :return: A tuple with the server response and the created zone.
+ """
+ zone = {
+ 'name': name or dns_data_utils.rand_zone_name(),
+ 'email': email or dns_data_utils.rand_email(),
+ 'ttl': ttl or dns_data_utils.rand_ttl(),
+ 'description': description or data_utils.rand_name('test-zone'),
+ }
+
+ resp, body = self._create_request('zones', zone, params=params)
+
+ if wait_until:
+ waiters.wait_for_zone_status(self, body['id'], wait_until)
+
+ return resp, body
+
+ @base.handle_errors
+ def show_zone(self, uuid, params=None):
+ """Gets a specific zone.
+ :param uuid: Unique identifier of the zone in UUID format.
+ :param params: A Python dict that represents the query paramaters to
+ include in the request URI.
+ :return: Serialized zone as a dictionary.
+ """
+ return self._show_request('zones', uuid, params=params)
+
+ @base.handle_errors
+ def delete_zone(self, uuid, params=None):
+ """Deletes a zone having the specified UUID.
+ :param uuid: The unique identifier of the zone.
+ :param params: A Python dict that represents the query paramaters to
+ include in the request URI.
+ :return: A tuple with the server response and the response body.
+ """
+ return self._delete_request('zones', uuid, params=params)
diff --git a/designate_tempest_plugin/tests/__init__.py b/designate_tempest_plugin/tests/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/designate_tempest_plugin/tests/__init__.py
diff --git a/designate_tempest_plugin/tests/api/__init__.py b/designate_tempest_plugin/tests/api/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/designate_tempest_plugin/tests/api/__init__.py
diff --git a/designate_tempest_plugin/tests/api/v2/__init__.py b/designate_tempest_plugin/tests/api/v2/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/designate_tempest_plugin/tests/api/v2/__init__.py
diff --git a/designate_tempest_plugin/tests/api/v2/base.py b/designate_tempest_plugin/tests/api/v2/base.py
new file mode 100644
index 0000000..d05d9d0
--- /dev/null
+++ b/designate_tempest_plugin/tests/api/v2/base.py
@@ -0,0 +1,31 @@
+# Copyright 2016 Hewlett Packard Enterprise Development Company, L.P.
+#
+# 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 import test
+
+from designate_tempest_plugin import clients
+
+
+class BaseDnsTest(test.BaseTestCase):
+ """Base class for DNS API v2 tests."""
+
+ # Use the Designate Client Manager
+ client_manager = clients.Manager
+
+ # NOTE(andreaf) credentials holds a list of the credentials to be allocated
+ # at class setup time. Credential types can be 'primary', 'alt', 'admin' or
+ # a list of roles - the first element of the list being a label, and the
+ # rest the actual roles.
+ # NOTE(kiall) primary will result in a manager @ cls.os, alt will have
+ # cls.os_alt, and admin will have cls.os_adm.
+ credentials = ['primary']
diff --git a/designate_tempest_plugin/tests/api/v2/test_zones.py b/designate_tempest_plugin/tests/api/v2/test_zones.py
new file mode 100644
index 0000000..345ff60
--- /dev/null
+++ b/designate_tempest_plugin/tests/api/v2/test_zones.py
@@ -0,0 +1,100 @@
+# Copyright 2016 Hewlett Packard Enterprise Development Company, L.P.
+#
+# 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.
+import six
+from oslo_log import log as logging
+from tempest import test
+from tempest.lib import exceptions as lib_exc
+
+from designate_tempest_plugin.tests.api.v2 import base
+from designate_tempest_plugin.common import waiters
+
+LOG = logging.getLogger(__name__)
+
+
+class BaseZonesTest(base.BaseDnsTest):
+ def _assertExpected(self, expected, actual):
+ for key, value in six.iteritems(expected):
+ if key not in ('created_at', 'updated_at', 'version', 'links',
+ 'status', 'action'):
+ self.assertIn(key, actual)
+ self.assertEqual(value, actual[key], key)
+
+
+class ZonesTest(BaseZonesTest):
+ @classmethod
+ def setup_clients(cls):
+ super(ZonesTest, cls).setup_clients()
+
+ cls.client = cls.os.zones_client
+
+ @test.attr(type='smoke')
+ @test.idempotent_id('9d2e20fc-e56f-4a62-9c61-9752a9ec615c')
+ def test_create_zone(self):
+ LOG.info('Create a zone')
+ _, zone = self.client.create_zone()
+ self.addCleanup(self.client.delete_zone, zone['id'])
+
+ LOG.info('Ensure we respond with CREATE+PENDING')
+ self.assertEqual('CREATE', zone['action'])
+ self.assertEqual('PENDING', zone['status'])
+
+ waiters.wait_for_zone_status(
+ self.client, zone['id'], 'ACTIVE')
+
+ LOG.info('Re-Fetch the zone')
+ _, body = self.client.show_zone(zone['id'])
+
+ LOG.info('Ensure the fetched response matches the created zone')
+ self._assertExpected(zone, body)
+
+ @test.attr(type='smoke')
+ @test.idempotent_id('a4791906-6cd6-4d27-9f15-32273db8bb3d')
+ def test_delete_zone(self):
+ LOG.info('Create a zone')
+ _, zone = self.client.create_zone(wait_until='ACTIVE')
+ self.addCleanup(self.client.delete_zone, zone['id'],
+ ignore_errors=lib_exc.NotFound)
+
+ LOG.info('Delete the zone')
+ _, body = self.client.delete_zone(zone['id'])
+
+ LOG.info('Ensure we respond with DELETE+PENDING')
+ self.assertEqual('DELETE', body['action'])
+ self.assertEqual('PENDING', body['status'])
+
+ waiters.wait_for_zone_404(self.client, zone['id'])
+
+
+class ZonesAdminTest(BaseZonesTest):
+ credentials = ['primary', 'admin']
+
+ @classmethod
+ def setup_clients(cls):
+ super(ZonesAdminTest, cls).setup_clients()
+
+ cls.client = cls.os.zones_client
+ cls.admin_client = cls.os_adm.zones_client
+
+ @test.idempotent_id('6477f92d-70ba-46eb-bd6c-fc50c405e222')
+ def test_get_other_tenant_zone(self):
+ LOG.info('Create a zone as a user')
+ _, zone = self.client.create_zone()
+ self.addCleanup(self.client.delete_zone, zone['id'])
+
+ LOG.info('Fetch the zone as an admin')
+ _, body = self.admin_client.show_zone(
+ zone['id'], params={'all_projects': True})
+
+ LOG.info('Ensure the fetched response matches the created zone')
+ self._assertExpected(zone, body)
diff --git a/designate_tempest_plugin/tests/scenario/__init__.py b/designate_tempest_plugin/tests/scenario/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/designate_tempest_plugin/tests/scenario/__init__.py