Merge "Stabilizing “PTR record” tests suite and adding new test cases"
diff --git a/designate_tempest_plugin/common/exceptions.py b/designate_tempest_plugin/common/exceptions.py
new file mode 100644
index 0000000..d3f343d
--- /dev/null
+++ b/designate_tempest_plugin/common/exceptions.py
@@ -0,0 +1,29 @@
+# Copyright 2021 Red Hat.
+#
+# 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.
+
+
+class InvalidStatusError(Exception):
+    """
+    Exception raise when an entity changes to an unexpected status.
+    """
+
+    def __init__(self, entity, entity_id, status, expected_status=None):
+        if expected_status:
+            message = ("{0} with ID {1} returned status {2} when {3} was "
+                       "expected.".format(entity, entity_id,
+                                          status, expected_status))
+        else:
+            message = ("{0} with ID {1} returned unexpected status {2}".format(
+                entity, entity_id, status))
+        super(InvalidStatusError, self).__init__(message)
diff --git a/designate_tempest_plugin/common/waiters.py b/designate_tempest_plugin/common/waiters.py
index 2422f37..6bc5dfa 100644
--- a/designate_tempest_plugin/common/waiters.py
+++ b/designate_tempest_plugin/common/waiters.py
@@ -18,6 +18,9 @@
 from tempest.lib.common.utils import test_utils
 from tempest.lib import exceptions as lib_exc
 
+from designate_tempest_plugin.common import constants as const
+from designate_tempest_plugin.common import exceptions
+
 LOG = logging.getLogger(__name__)
 
 
@@ -35,6 +38,10 @@
             LOG.info('Zone %s is 404ing', zone_id)
             return
 
+        if zone['status'] == const.ERROR:
+            raise exceptions.InvalidStatusError('Zone', zone_id,
+                                                zone['status'])
+
         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: '
diff --git a/designate_tempest_plugin/data_utils.py b/designate_tempest_plugin/data_utils.py
index 98db929..4b5d24d 100644
--- a/designate_tempest_plugin/data_utils.py
+++ b/designate_tempest_plugin/data_utils.py
@@ -97,8 +97,8 @@
         quotas_dict['api_export_size'] = \
             api_export_size or data_utils.rand_int_id(100, 999999)
     else:
-        LOG.warn("Leaving `api_export_size` out of quota data due to: "
-                 "https://bugs.launchpad.net/designate/+bug/1573141")
+        LOG.warning("Leaving `api_export_size` out of quota data due to: "
+                    "https://bugs.launchpad.net/designate/+bug/1573141")
 
     return quotas_dict
 
@@ -142,10 +142,12 @@
         'ttl': ttl}
 
 
-def rand_a_recordset(zone_name, ip=None, **kwargs):
-    if ip is None:
-        ip = rand_ip()
-    return rand_recordset_data('A', zone_name, records=[ip], **kwargs)
+def rand_a_recordset(zone_name, ips=None, **kwargs):
+    if ips is None:
+        return rand_recordset_data(
+            'A', zone_name, records=[rand_ip()], **kwargs)
+    else:
+        return rand_recordset_data('A', zone_name, records=ips, **kwargs)
 
 
 def rand_aaaa_recordset(zone_name, ip=None, **kwargs):
diff --git a/designate_tempest_plugin/services/dns/json/base.py b/designate_tempest_plugin/services/dns/json/base.py
index cbfb34f..d484ac9 100644
--- a/designate_tempest_plugin/services/dns/json/base.py
+++ b/designate_tempest_plugin/services/dns/json/base.py
@@ -82,7 +82,7 @@
                        "received not-int read_code %(read_code)r" %
                        {'expected_code': expected_code,
                         'read_code': read_code})
-            LOG.warn(message)
+            LOG.warning(message)
         return super(DnsClientBase, cls).expected_success(
             expected_code=expected_code, read_code=int(read_code),
         )
diff --git a/designate_tempest_plugin/tests/api/v2/test_enabled_api_version.py b/designate_tempest_plugin/tests/api/v2/test_enabled_api_version.py
index db98a9d..c5fcd69 100644
--- a/designate_tempest_plugin/tests/api/v2/test_enabled_api_version.py
+++ b/designate_tempest_plugin/tests/api/v2/test_enabled_api_version.py
@@ -51,8 +51,8 @@
                 versions = self.primary_client.list_enabled_api_versions()[1][
                     'versions']['values']
             if user == 'not_auth_user':
-                uri = CONF.identity.uri.split('identity')[0] + 'dns'
-                response = requests.get(uri, verify=False)
+                response = requests.get(self.primary_client.base_url,
+                                        verify=False)
                 headers = {
                     k.lower(): v.lower() for k, v in response.headers.items()}
                 versions = self.deserialize(
diff --git a/designate_tempest_plugin/tests/api/v2/test_recordset.py b/designate_tempest_plugin/tests/api/v2/test_recordset.py
index 5184983..38a2dfd 100644
--- a/designate_tempest_plugin/tests/api/v2/test_recordset.py
+++ b/designate_tempest_plugin/tests/api/v2/test_recordset.py
@@ -19,6 +19,8 @@
 import ddt
 
 from designate_tempest_plugin.tests import base
+from designate_tempest_plugin.common import constants as const
+
 from designate_tempest_plugin.common import waiters
 from designate_tempest_plugin import data_utils
 
@@ -80,13 +82,16 @@
         LOG.info('Create a Recordset')
         resp, body = self.client.create_recordset(
             self.zone['id'], recordset_data)
+        self.addCleanup(
+            self.wait_recordset_delete, self.client,
+            self.zone['id'], body['id'])
 
         LOG.info('Ensure we respond with PENDING')
-        self.assertEqual('PENDING', body['status'])
+        self.assertEqual(const.PENDING, body['status'])
 
-    @decorators.idempotent_id('d03b69a5-5052-43bc-a38a-b511b6b34304')
-    @ddt.file_data("recordset_data.json")
-    def test_create_all_recordset_types(self, name, type, records):
+    # We cannot use DDT here as these tests are part of the refstack
+    # interoperability test suite and need to be unique for traceability.
+    def _test_create_recordset_type(self, name, type, records):
         if name is not None:
             recordset_name = name + "." + self.zone['name']
 
@@ -102,9 +107,61 @@
         LOG.info('Create a Recordset')
         resp, body = self.client.create_recordset(
             self.zone['id'], recordset_data)
+        self.addCleanup(
+            self.wait_recordset_delete, self.client,
+            self.zone['id'], body['id'])
 
         LOG.info('Ensure we respond with PENDING')
-        self.assertEqual('PENDING', body['status'])
+        self.assertEqual(const.PENDING, body['status'])
+
+    @decorators.idempotent_id('d03b69a5-5052-43bc-a38a-b511b6b34304')
+    def test_create_recordset_type_A(self):
+        self._test_create_recordset_type(
+            "www", "A", ["192.0.2.1", "192.0.2.2", "192.0.2.3"])
+
+    @decorators.idempotent_id('ac110198-d58a-4a18-aceb-414d7e513d49')
+    def test_create_recordset_type_AAAA(self):
+        self._test_create_recordset_type(
+            "www", "AAAA", ["2001:db8::1", "2001:db8::1", "2001:db8::"])
+
+    @decorators.idempotent_id('6c22a3f9-3f4d-4b32-bdf2-5237851ed25e')
+    def test_create_recordset_type_SRV_TCP(self):
+        self._test_create_recordset_type(
+            "_sip._tcp", "SRV", ["10 60 5060 server1.example.com.",
+                                 "20 60 5060 server2.example.com.",
+                                 "20 30 5060 server3.example.com."])
+
+    @decorators.idempotent_id('59c1aa42-278e-4f7b-a6a1-4320d5daf1fd')
+    def test_create_recordset_type_SRV_UDP(self):
+        self._test_create_recordset_type(
+            "_sip._udp", "SRV", ["10 60 5060 server1.example.com.",
+                                 "10 60 5060 server2.example.com.",
+                                 "20 30 5060 server3.example.com."])
+
+    @decorators.idempotent_id('1ac46f94-f03a-4f85-b84f-826a2660b927')
+    def test_create_recordset_type_CNAME(self):
+        self._test_create_recordset_type(
+            "alias-of-target", "CNAME", ["target.example.org."])
+
+    @decorators.idempotent_id('bf872487-7975-4a96-bb03-d24e393a0ce8')
+    def test_create_recordset_type_MX_at_APEX(self):
+        self._test_create_recordset_type(
+            None, "MX", ["10 mail1.example.org.", "20 mail2.example.org."])
+
+    @decorators.idempotent_id('96fe72a4-a81c-4a01-a81f-39ebafad115c')
+    def test_create_recordset_type_MX_under_APEX(self):
+        self._test_create_recordset_type(
+            "under", "MX", ["10 mail.example.org."])
+
+    @decorators.idempotent_id('481496f1-917a-40d5-89fd-4a3794c24215')
+    def test_create_recordset_type_SSHFP(self):
+        self._test_create_recordset_type(
+            "www", "SSHFP", ["2 1 123456789abcdef67890123456789abcdef67890"])
+
+    @decorators.idempotent_id('8e7ecedb-5c35-46f8-ae0e-39e4aaabc97d')
+    def test_create_recordset_type_TXT(self):
+        self._test_create_recordset_type(
+            "www", "TXT", ["\"Any Old Text Goes Here\""])
 
     @decorators.idempotent_id('69f002e5-6511-43d3-abae-7abdd45ae03e')
     @ddt.file_data("recordset_wildcard_data.json")
@@ -124,9 +181,12 @@
         LOG.info('Create a Recordset')
         resp, body = self.client.create_recordset(
             self.zone['id'], recordset_data)
+        self.addCleanup(
+            self.wait_recordset_delete, self.client,
+            self.zone['id'], body['id'])
 
         LOG.info('Ensure we respond with PENDING')
-        self.assertEqual('PENDING', body['status'])
+        self.assertEqual(const.PENDING, body['status'])
 
     @decorators.idempotent_id('5964f730-5546-46e6-9105-5030e9c492b2')
     def test_list_recordsets(self):
@@ -136,6 +196,9 @@
         LOG.info('Create a Recordset')
         resp, body = self.client.create_recordset(
             self.zone['id'], recordset_data)
+        self.addCleanup(
+            self.wait_recordset_delete, self.client,
+            self.zone['id'], body['id'])
 
         LOG.info('List zone recordsets')
         _, body = self.client.list_recordset(self.zone['id'])
@@ -150,6 +213,9 @@
         LOG.info('Create a Recordset')
         resp, body = self.client.create_recordset(
             self.zone['id'], recordset_data)
+        self.addCleanup(
+            self.wait_recordset_delete, self.client,
+            self.zone['id'], body['id'])
 
         LOG.info('Re-Fetch the Recordset')
         _, record = self.client.show_recordset(self.zone['id'], body['id'])
@@ -165,6 +231,9 @@
         LOG.info('Create a Recordset')
         _, record = self.client.create_recordset(
             self.zone['id'], recordset_data)
+        self.addCleanup(
+            self.wait_recordset_delete, self.client,
+            self.zone['id'], record['id'])
 
         LOG.info('Delete a Recordset')
         _, body = self.client.delete_recordset(self.zone['id'], record['id'])
@@ -181,6 +250,9 @@
         LOG.info('Create a recordset')
         _, record = self.client.create_recordset(
             self.zone['id'], recordset_data)
+        self.addCleanup(
+            self.wait_recordset_delete, self.client,
+            self.zone['id'], record['id'])
 
         recordset_data = data_utils.rand_recordset_data(
             record_type='A', zone_name=self.zone['name'], name=record['name'])
@@ -200,6 +272,9 @@
         LOG.info('Create a recordset')
         _, record = self.client.create_recordset(
             self.zone['id'], recordset_data)
+        self.addCleanup(
+            self.wait_recordset_delete, self.client,
+            self.zone['id'], record['id'])
 
         recordset_data = {
             'ttl': data_utils.rand_ttl(start=record['ttl'] + 1)
@@ -222,12 +297,15 @@
             record_type='A', zone_name=self.zone['name'])
         resp, body = self.client.create_recordset(
             self.zone['id'], recordset_data)
-        self.assertEqual('PENDING', body['status'],
+        self.addCleanup(
+            self.wait_recordset_delete, self.client,
+            self.zone['id'], body['id'])
+        self.assertEqual(const.PENDING, body['status'],
                          'Failed, expected status is PENDING')
         LOG.info('Wait until the recordset is active')
         waiters.wait_for_recordset_status(
             self.client, self.zone['id'],
-            body['id'], 'ACTIVE')
+            body['id'], const.ACTIVE)
 
         LOG.info('Re-Fetch the Recordset as Alt tenant with '
                  '"x-auth-sudo-project-id" HTTP header included in request. '
@@ -259,13 +337,19 @@
             record_type='A', zone_name=self.zone['name'])
         body_pr_1 = self.client.create_recordset(
             self.zone['id'], recordset_data_primary_1)[1]
-        self.assertEqual('PENDING', body_pr_1['status'],
+        self.addCleanup(
+            self.wait_recordset_delete, self.client,
+            self.zone['id'], body_pr_1['id'])
+        self.assertEqual(const.PENDING, body_pr_1['status'],
                          'Failed, expected status is PENDING')
         recordset_data_primary_2 = data_utils.rand_recordset_data(
             record_type='A', zone_name=self.zone['name'])
         body_pr_2 = self.client.create_recordset(
             self.zone['id'], recordset_data_primary_2)[1]
-        self.assertEqual('PENDING', body_pr_2['status'],
+        self.addCleanup(
+            self.wait_recordset_delete, self.client,
+            self.zone['id'], body_pr_2['id'])
+        self.assertEqual(const.PENDING, body_pr_2['status'],
                          'Failed, expected status is PENDING')
 
         LOG.info('Re-Fetch Recordsets as Alt tenant for a Primary project. '
@@ -298,6 +382,24 @@
                 'Failed, recordset ID:{} was not found in listed '
                 'recordsets: {}'.format(recordset_id, primary_recordsets_ids))
 
+    @decorators.idempotent_id('48013b7c-f526-11eb-b04f-74e5f9e2a801')
+    def test_create_A_recordset_multiply_ips(self):
+        LOG.info('Create A type Recordset using a list of random IPs')
+        recordset_data = data_utils.rand_a_recordset(
+            zone_name=self.zone['name'],
+            ips=[data_utils.rand_ip() for _ in range(10)])
+        resp, body = self.client.create_recordset(
+            self.zone['id'], recordset_data)
+        self.addCleanup(
+            self.wait_recordset_delete, self.client,
+            self.zone['id'], body['id'])
+        LOG.info('Ensure we respond with PENDING')
+        self.assertEqual(const.PENDING, body['status'])
+        LOG.info('Wait until the recordset is active')
+        waiters.wait_for_recordset_status(
+            self.client, self.zone['id'],
+            body['id'], const.ACTIVE)
+
 
 @ddt.ddt
 class RecordsetsNegativeTest(BaseRecordsetsTest):
@@ -415,12 +517,15 @@
             record_type='A', zone_name=self.zone['name'])
         resp, body = self.client.create_recordset(
             self.zone['id'], recordset_data)
-        self.assertEqual('PENDING', body['status'],
+        self.addCleanup(
+            self.wait_recordset_delete, self.client,
+            self.zone['id'], body['id'])
+        self.assertEqual(const.PENDING, body['status'],
                          'Failed, expected status is PENDING')
         LOG.info('Wait until the recordset is active')
         waiters.wait_for_recordset_status(
             self.client, self.zone['id'],
-            body['id'], 'ACTIVE')
+            body['id'], const.ACTIVE)
 
         LOG.info('Ensure 404 NotFound status code is received if '
                  'recordset ID is invalid.')
@@ -485,6 +590,9 @@
         LOG.info('Create a Recordset')
         resp, zone_recordset = self.client.create_recordset(
             self.zone['id'], recordset_data)
+        self.addCleanup(
+            self.wait_recordset_delete, self.client,
+            self.zone['id'], zone_recordset['id'])
 
         self.client.show_zones_recordset(zone_recordset['id'])
 
@@ -496,6 +604,9 @@
         LOG.info('Create a Recordset')
         resp, zone_recordset = self.client.create_recordset(
             self.zone['id'], recordset_data)
+        self.addCleanup(
+            self.wait_recordset_delete, self.client,
+            self.zone['id'], zone_recordset['id'])
 
         LOG.info('Create another zone')
         _, zone2 = self.zone_client.create_zone()
@@ -507,6 +618,9 @@
             records=['10.0.1.3'])
         resp, zone_recordset2 = self.client.create_recordset(
             zone2['id'], recordset_data)
+        self.addCleanup(
+            self.wait_recordset_delete, self.client,
+            self.zone['id'], zone_recordset2['id'])
 
         LOG.info('List recordsets')
         _, body = self.client.list_zones_recordsets(params={"data": "10.0.*"})
@@ -577,19 +691,22 @@
                                 self.zone_client,
                                 zone['id'])
                 waiters.wait_for_zone_status(
-                    self.zone_client, zone['id'], 'ACTIVE')
+                    self.zone_client, zone['id'], const.ACTIVE)
 
                 # Create a recordset and wait till it's ACTIVE
                 recordset_data = data_utils.rand_recordset_data(
                     record_type='A', zone_name=zone['name'])
                 resp, body = self.client.create_recordset(
                     zone['id'], recordset_data)
-                self.assertEqual('PENDING', body['status'],
+                self.addCleanup(
+                    self.wait_recordset_delete, self.client,
+                    self.zone['id'], body['id'])
+                self.assertEqual(const.PENDING, body['status'],
                                  'Failed, expected status is PENDING')
                 LOG.info('Wait until the recordset is active')
                 waiters.wait_for_recordset_status(
                     self.client, zone['id'],
-                    body['id'], 'ACTIVE')
+                    body['id'], const.ACTIVE)
 
                 # Add "project_id" into the recordset_data
                 recordset_data['project_id'] = zone['project_id']
@@ -602,19 +719,22 @@
                                 self.alt_zone_client,
                                 alt_zone['id'])
                 waiters.wait_for_zone_status(
-                    self.alt_zone_client, alt_zone['id'], 'ACTIVE')
+                    self.alt_zone_client, alt_zone['id'], const.ACTIVE)
 
                 # Create a recordset and wait till it's ACTIVE
                 recordset_data = data_utils.rand_recordset_data(
                     record_type='A', zone_name=alt_zone['name'])
                 resp, body = self.alt_client.create_recordset(
                     alt_zone['id'], recordset_data)
-                self.assertEqual('PENDING', body['status'],
+                self.addCleanup(
+                    self.wait_recordset_delete, self.client,
+                    self.zone['id'], body['id'])
+                self.assertEqual(const.PENDING, body['status'],
                                  'Failed, expected status is PENDING')
                 LOG.info('Wait until the recordset is active')
                 waiters.wait_for_recordset_status(
                     self.alt_client, alt_zone['id'],
-                    body['id'], 'ACTIVE')
+                    body['id'], const.ACTIVE)
 
                 # Add "project_id" into the recordset_data
                 recordset_data['project_id'] = alt_zone['project_id']
@@ -629,6 +749,9 @@
             record_type='A', zone_name=self.zone['name'])
         resp, rrset = self.client.create_recordset(
             self.zone['id'], recordset_data)
+        self.addCleanup(
+            self.wait_recordset_delete, self.client,
+            self.zone['id'], rrset['id'])
         self.assertRaises(
             lib_exc.RestClientException,
             lambda: self.alt_client.create_recordset(
diff --git a/designate_tempest_plugin/tests/base.py b/designate_tempest_plugin/tests/base.py
index 82d18fd..2e02a8c 100644
--- a/designate_tempest_plugin/tests/base.py
+++ b/designate_tempest_plugin/tests/base.py
@@ -124,6 +124,17 @@
                               zone_client,
                               zone_id)
 
+    def wait_recordset_delete(self, recordset_client, zone_id,
+                              recordset_id, **kwargs):
+        self._delete_recordset(
+            recordset_client, zone_id, recordset_id, **kwargs)
+        utils.call_until_true(self._check_recordset_deleted,
+                              CONF.dns.build_timeout,
+                              CONF.dns.build_interval,
+                              recordset_client,
+                              zone_id,
+                              recordset_id)
+
     def _delete_zone(self, zone_client, zone_id, **kwargs):
         return utils.call_and_ignore_notfound_exc(zone_client.delete_zone,
                                                   zone_id, **kwargs)
@@ -132,6 +143,17 @@
         return utils.call_and_ignore_notfound_exc(zone_client.show_zone,
                                                   zone_id) is None
 
+    def _delete_recordset(self, recordset_client, zone_id,
+                          recordset_id, **kwargs):
+        return utils.call_and_ignore_notfound_exc(
+            recordset_client.delete_recordset,
+            zone_id, recordset_id, **kwargs)
+
+    def _check_recordset_deleted(
+            self, recordset_client, zone_id, recordset_id):
+        return utils.call_and_ignore_notfound_exc(
+            recordset_client.show_recordset, zone_id, recordset_id) is None
+
 
 class BaseDnsV2Test(BaseDnsTest):
     """Base class for DNS V2 API tests."""
diff --git a/designate_tempest_plugin/tests/api/v2/recordset_data.json b/designate_tempest_plugin/tests/scenario/v2/recordset_data.json
similarity index 100%
rename from designate_tempest_plugin/tests/api/v2/recordset_data.json
rename to designate_tempest_plugin/tests/scenario/v2/recordset_data.json
diff --git a/designate_tempest_plugin/tests/scenario/v2/test_blacklists.py b/designate_tempest_plugin/tests/scenario/v2/test_blacklists.py
index 696c661..27b3f7f 100644
--- a/designate_tempest_plugin/tests/scenario/v2/test_blacklists.py
+++ b/designate_tempest_plugin/tests/scenario/v2/test_blacklists.py
@@ -13,12 +13,14 @@
 # under the License.
 
 from oslo_log import log as logging
+from tempest import config
 from tempest.lib import decorators
 from tempest.lib import exceptions as lib_exc
 
 from designate_tempest_plugin import data_utils as dns_data_utils
 from designate_tempest_plugin.tests import base
 
+CONF = config.CONF
 LOG = logging.getLogger(__name__)
 
 
@@ -28,7 +30,7 @@
 
 class BlacklistE2E(BaseBlacklistsTest):
 
-    credentials = ["admin", 'primary']
+    credentials = ["admin", 'primary', 'system_admin']
 
     @classmethod
     def setup_credentials(cls):
@@ -39,30 +41,36 @@
     @classmethod
     def setup_clients(cls):
         super(BlacklistE2E, cls).setup_clients()
-        cls.admin_blacklist_client = cls.os_admin.dns_v2.BlacklistsClient()
-        cls.admin_zone_client = cls.os_admin.dns_v2.ZonesClient()
+        if CONF.enforce_scope.designate:
+            cls.admin_blacklist_client = (
+                cls.os_system_admin.dns_v2.BlacklistsClient())
+            cls.admin_zone_client = cls.os_system_admin.dns_v2.ZonesClient()
+        else:
+            cls.admin_blacklist_client = cls.os_admin.dns_v2.BlacklistsClient()
+            cls.admin_zone_client = cls.os_admin.dns_v2.ZonesClient()
         cls.primary_zone_client = cls.os_primary.dns_v2.ZonesClient()
 
     @decorators.idempotent_id('22b1ee72-d8d2-11eb-bcdc-74e5f9e2a801')
     def test_primary_fails_to_create_zone_matches_blacklist_regex(self):
         LOG.info('Create a blacklist using regex')
         blacklist = {
-            'pattern': '^a.*',
-            'description': 'Zone starts with "a" char'}
+            'pattern': '^blacklistregextest.*',
+            'description': 'Zone starts with "blacklistregextest" char'}
         body = self.admin_blacklist_client.create_blacklist(**blacklist)[1]
         self.addCleanup(
             self.admin_blacklist_client.delete_blacklist, body['id'])
 
-        LOG.info('Try to create a zone that is starts with "a" character')
+        LOG.info('Try to create a zone that is starts with '
+                 '"blacklistregextest".')
         self.assertRaisesDns(
             lib_exc.BadRequest, 'invalid_zone_name', 400,
             self.primary_zone_client.create_zone,
-            name='a' + dns_data_utils.rand_zone_name())
+            name='blacklistregextest' + dns_data_utils.rand_zone_name())
 
     @decorators.idempotent_id('6956f20c-d8d5-11eb-bcdc-74e5f9e2a801')
     def test_primary_fails_to_create_zone_matches_blacklist_name(self):
         LOG.info('Create a blacklist using the exact name(string)')
-        zone_name = dns_data_utils.rand_zone_name()
+        zone_name = 'blacklistnametest' + dns_data_utils.rand_zone_name()
         blacklist = {
             'pattern': zone_name,
             'description': 'Zone named:{} '.format(zone_name)}
@@ -78,9 +86,10 @@
     @decorators.idempotent_id('de030088-d97e-11eb-8ab8-74e5f9e2a801')
     def test_admin_creates_zone_matches_blacklist_name_or_regex(self):
         LOG.info('Create a blacklists using: regex and exact string(name)')
-        zone_name = dns_data_utils.rand_zone_name()
+        zone_name = 'blacklistnameregextest1' + dns_data_utils.rand_zone_name()
         blacklists = [
-            {'pattern': '^a.*', 'description': 'Zone starts with "a" char'},
+            {'pattern': '^blacklistnameregextest2.*',
+             'description': 'Zone starts with "a" char'},
             {'pattern': zone_name,
              'description': 'Deny if Zone named:{} '.format(zone_name)}]
         for blacklist in blacklists:
@@ -91,9 +100,12 @@
         LOG.info('As Admin user try to create zones that are '
                  'supposed to be blocked')
         zone = self.admin_zone_client.create_zone(
-            name='a' + dns_data_utils.rand_zone_name())[1]
+            name='blacklistnameregextest2' +
+                 dns_data_utils.rand_zone_name(),
+            project_id=self.primary_zone_client.project_id)[1]
         self.addCleanup(
             self.wait_zone_delete, self.admin_zone_client, zone['id'])
-        zone = self.admin_zone_client.create_zone(name=zone_name)[1]
+        zone = self.admin_zone_client.create_zone(
+            name=zone_name, project_id=self.primary_zone_client.project_id)[1]
         self.addCleanup(
             self.wait_zone_delete, self.admin_zone_client, zone['id'])
diff --git a/designate_tempest_plugin/tests/scenario/v2/test_recordsets.py b/designate_tempest_plugin/tests/scenario/v2/test_recordsets.py
index def1150..0808f56 100644
--- a/designate_tempest_plugin/tests/scenario/v2/test_recordsets.py
+++ b/designate_tempest_plugin/tests/scenario/v2/test_recordsets.py
@@ -56,7 +56,7 @@
 
     @decorators.attr(type='slow')
     @decorators.idempotent_id('4664ed66-9ff1-45f2-9e60-d4913195c505')
-    @ddt.file_data("../../api/v2/recordset_data.json")
+    @ddt.file_data("recordset_data.json")
     def test_create_and_delete_records_on_existing_zone(self, name,
                                                         type, records):
         if name is not None: