Merge "Adding new test cases for zone export showfile API"
diff --git a/.zuul.yaml b/.zuul.yaml
index 02cd904..cf8323b 100644
--- a/.zuul.yaml
+++ b/.zuul.yaml
@@ -1,3 +1,23 @@
+- job:
+    name: designate-bind9-stable-xena
+    parent: designate-bind9
+    override-checkout: stable/xena
+
+- job:
+    name: designate-bind9-stable-wallaby
+    parent: designate-bind9
+    override-checkout: stable/wallaby
+
+- job:
+    name: designate-bind9-stable-victoria
+    parent: designate-bind9
+    override-checkout: stable/victoria
+
+- job:
+    name: designate-bind9-stable-ussuri
+    parent: designate-bind9
+    override-checkout: stable/ussuri
+
 - project:
     templates:
       - designate-devstack-jobs
@@ -7,6 +27,10 @@
       - release-notes-jobs-python3
     check:
       jobs:
+        - designate-bind9-stable-xena
+        - designate-bind9-stable-wallaby
+        - designate-bind9-stable-victoria
+        - designate-bind9-stable-ussuri
         - neutron-tempest-plugin-designate-scenario
     gate:
       queue: designate
diff --git a/designate_tempest_plugin/tests/api/v2/test_transfer_request.py b/designate_tempest_plugin/tests/api/v2/test_transfer_request.py
index 794fafa..6c8ed07 100644
--- a/designate_tempest_plugin/tests/api/v2/test_transfer_request.py
+++ b/designate_tempest_plugin/tests/api/v2/test_transfer_request.py
@@ -248,6 +248,37 @@
                           "Failed, transfer request ID:{} wasn't found in "
                           "listed IDs{}".format(request_id, request_ids))
 
+    @decorators.idempotent_id('bee42f38-e666-4b85-a710-01f40ea1e56a')
+    def test_list_transfer_requests_impersonate_another_project(self):
+        LOG.info('Create a Primary zone')
+        primary_zone = self.zone_client.create_zone()[1]
+        self.addCleanup(self.wait_zone_delete,
+                        self.zone_client, primary_zone['id'])
+
+        LOG.info('Create an Alt zone')
+        alt_zone = self.alt_zone_client.create_zone()[1]
+        self.addCleanup(self.wait_zone_delete,
+                        self.alt_zone_client, alt_zone['id'])
+
+        LOG.info('Create a zone transfer_request using Primary client')
+        primary_transfer_request = self.client.create_transfer_request(
+            primary_zone['id'])[1]
+        self.addCleanup(self.client.delete_transfer_request,
+                        primary_transfer_request['id'])
+
+        LOG.info('Create a zone transfer_request using Alt client')
+        alt_transfer_request = self.alt_client.create_transfer_request(
+            alt_zone['id'])[1]
+        self.addCleanup(self.alt_client.delete_transfer_request,
+                        alt_transfer_request['id'])
+
+        request_ids = [
+            item['id'] for item in self.admin_client.list_transfer_requests(
+                headers={'x-auth-sudo-project-id': self.alt_client.project_id},
+                params={'limit': 1000})[1]['transfer_requests']]
+
+        self.assertEqual([alt_transfer_request['id']], request_ids)
+
     @decorators.idempotent_id('de5e9d32-c723-4518-84e5-58da9722cc13')
     def test_update_transfer_request(self):
         LOG.info('Create a zone')
diff --git a/designate_tempest_plugin/tests/scenario/v2/recordset_data.json b/designate_tempest_plugin/tests/scenario/v2/recordset_data.json
index 9f365a7..3168722 100644
--- a/designate_tempest_plugin/tests/scenario/v2/recordset_data.json
+++ b/designate_tempest_plugin/tests/scenario/v2/recordset_data.json
@@ -48,5 +48,37 @@
         "name": "www",
         "type": "TXT",
         "records": ["\"Any Old Text Goes Here\""]
+    },
+    "SPF": {
+        "name": "*.sub",
+        "type": "SPF",
+        "records": ["\"v=spf1; a -all\""]
+    },
+    "NS": {
+        "name": "NS_Record",
+        "type": "NS",
+        "records": ["ns1.example.org."]
+    },
+    "PTR_IPV4": {
+        "name": "PTR_Record_IPV4",
+        "type": "PTR",
+        "records": ["34.216.184.93.in-addr.arpa."]
+    },
+   "PTR_IPV6":{
+       "name":"PTR_Record_IPV6",
+       "type":"PTR",
+       "records":[
+           "6.4.9.1.8.c.5.2.3.9.8.1.8.4.2.0.1.0.0.0.0.2.2.0.0.0.8.2.6.0.6.2.ip6.arpa."
+      ]
+   },
+   "CAA_Record": {
+       "name": "CAA_Record",
+       "type": "CAA",
+       "records": ["0 issue letsencrypt.org"]
+    },
+   "NAPTR_Record": {
+       "name": "NAPTR_Record",
+       "type": "NAPTR",
+       "records": ["0 0 S SIP+D2U !^.*$!sip:customer-service@example.com! _sip._udp.example.com."]
     }
-}
+}
\ No newline at end of file
diff --git a/designate_tempest_plugin/tests/scenario/v2/test_recordsets.py b/designate_tempest_plugin/tests/scenario/v2/test_recordsets.py
index 0808f56..4c40c28 100644
--- a/designate_tempest_plugin/tests/scenario/v2/test_recordsets.py
+++ b/designate_tempest_plugin/tests/scenario/v2/test_recordsets.py
@@ -27,10 +27,16 @@
 
 @ddt.ddt
 class RecordsetsTest(base.BaseDnsV2Test):
+
+    credentials = ["admin", "system_admin", "primary"]
+
     @classmethod
     def setup_clients(cls):
         super(RecordsetsTest, cls).setup_clients()
-
+        if CONF.enforce_scope.designate:
+            cls.admin_client = cls.os_system_admin.dns_v2.RecordsetClient()
+        else:
+            cls.admin_client = cls.os_admin.dns_v2.RecordsetClient()
         cls.client = cls.os_primary.dns_v2.ZonesClient()
         cls.recordset_client = cls.os_primary.dns_v2.RecordsetClient()
 
@@ -98,3 +104,21 @@
         self.assertRaises(lib_exc.NotFound,
                           lambda: self.recordset_client.show_recordset(
                               self.zone['id'], recordset['id']))
+
+    @decorators.idempotent_id('1e78a742-66ee-11ec-8dc3-201e8823901f')
+    def test_create_soa_record_not_permitted(self):
+        # SOA record is automatically created for a zone, no user
+        # should be able to create a SOA record.
+        soa_record = ("s1.devstack.org. admin.example.net. 1510721487 3510"
+                      " 600 86400 3600")
+        LOG.info('Primary tries to create a Recordset on '
+                 'the existing zone')
+        self.assertRaises(
+            lib_exc.BadRequest,
+            self.recordset_client.create_recordset,
+            self.zone['id'], soa_record)
+        LOG.info('Admin tries to create a Recordset on the existing zone')
+        self.assertRaises(
+            lib_exc.BadRequest,
+            self.admin_client.create_recordset,
+            self.zone['id'], soa_record)
diff --git a/tox.ini b/tox.ini
index f1581bc..a413aeb 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,6 +1,6 @@
 [tox]
-minversion = 3.1.1
-envlist = py37,pep8
+minversion = 3.18.0
+envlist = pep8
 skipsdist = True
 ignore_basepython_conflict = True
 
@@ -9,7 +9,7 @@
 usedevelop = True
 install_command = pip install {opts} {packages}
 deps =
-       -c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt}
+       -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
        -r{toxinidir}/requirements.txt
        -r{toxinidir}/test-requirements.txt
 setenv =