Merge "Add client's methods and testcases for tsigkey"
diff --git a/designate_tempest_plugin/tests/api/v2/recordset_data.json b/designate_tempest_plugin/tests/api/v2/recordset_data.json
new file mode 100644
index 0000000..e9483b8
--- /dev/null
+++ b/designate_tempest_plugin/tests/api/v2/recordset_data.json
@@ -0,0 +1,57 @@
+{
+ "A": {
+ "name": "www",
+ "type": "A",
+ "records": ["192.0.2.1", "192.0.2.2", "192.0.2.3"]
+ },
+ "AAAA": {
+ "name": "www",
+ "type": "AAAA",
+ "records": ["2001:db8::1", "2001:db8::1", "2001:db8::"]
+ },
+ "SRV TCP": {
+ "name": "_sip._tcp",
+ "type": "SRV",
+ "records": ["10 60 5060 server1.example.com.",
+ "20 60 5060 server2.example.com.",
+ "20 30 5060 server3.example.com."]
+ },
+ "SRV UDP": {
+ "name": "_sip._udp",
+ "type": "SRV",
+ "records": ["10 60 5060 server1.example.com.",
+ "10 60 5060 server2.example.com.",
+ "20 30 5060 server3.example.com."]
+ },
+ "CNAME": {
+ "name": "www",
+ "type": "CNAME",
+ "records": ["target.example.org."]
+ },
+ "MX at APEX": {
+ "name": null,
+ "type": "MX",
+ "records": ["10 mail.example.org."]
+ },
+ "MX at APEX multiple": {
+ "name": null,
+ "type": "MX",
+ "records": ["10 mail1.example.org.",
+ "20 mail2.example.org."]
+ },
+ "MX under APEX": {
+ "name": "under",
+ "type": "MX",
+ "records": ["10 mail.example.org."]
+ },
+ "SSHFP": {
+ "name": "www",
+ "type": "SSHFP",
+ "records": ["2 1 123456789abcdef67890123456789abcdef67890"]
+ },
+ "TXT": {
+ "name": "www",
+ "type": "TXT",
+ "records": ["Any Old Text Goes Here"]
+ }
+}
diff --git a/designate_tempest_plugin/tests/api/v2/recordset_data_invalid.json b/designate_tempest_plugin/tests/api/v2/recordset_data_invalid.json
new file mode 100644
index 0000000..413698f
--- /dev/null
+++ b/designate_tempest_plugin/tests/api/v2/recordset_data_invalid.json
@@ -0,0 +1,12 @@
+{
+ "CNAME multiple": {
+ "name": "www",
+ "type": "CNAME",
+ "records": ["target1.example.org.", "target2.example.org."]
+ },
+ "CNAME at Apex": {
+ "name": null,
+ "type": "CNAME",
+ "records": ["target1.example.org."]
+ }
+}
diff --git a/designate_tempest_plugin/tests/api/v2/test_recordset.py b/designate_tempest_plugin/tests/api/v2/test_recordset.py
index ab2c6a4..5d45f01 100644
--- a/designate_tempest_plugin/tests/api/v2/test_recordset.py
+++ b/designate_tempest_plugin/tests/api/v2/test_recordset.py
@@ -15,6 +15,7 @@
from tempest import config
from tempest import test
from tempest.lib import exceptions as lib_exc
+import ddt
from designate_tempest_plugin.tests import base
from designate_tempest_plugin import data_utils
@@ -29,6 +30,7 @@
'type']
+@ddt.ddt
class RecordsetsTest(BaseRecordsetsTest):
@classmethod
def setup_clients(cls):
@@ -134,6 +136,40 @@
self.assertNotEqual(record['records'], update['records'])
+@ddt.ddt
+class RecordsetsNegativeTest(BaseRecordsetsTest):
+ @classmethod
+ def setup_clients(cls):
+ super(RecordsetsNegativeTest, cls).setup_clients()
+
+ cls.client = cls.os.recordset_client
+ cls.zone_client = cls.os.zones_client
+
+ @test.attr(type='smoke')
+ @test.idempotent_id('631d74fd-6909-4684-a61b-5c4d2f92c3e7')
+ @ddt.file_data("recordset_data_invalid.json")
+ def test_create_recordset_invalid(self, name, type, records):
+ LOG.info('Create a zone')
+ _, zone = self.zone_client.create_zone()
+ self.addCleanup(self.zone_client.delete_zone, zone['id'])
+
+ if name is not None:
+ recordset_name = name + "." + zone['name']
+
+ else:
+ recordset_name = zone['name']
+
+ recordset_data = {
+ 'name': recordset_name,
+ 'type': type,
+ 'records': records,
+ }
+
+ LOG.info('Attempt to create a invalid Recordset')
+ self.assertRaises(lib_exc.BadRequest,
+ lambda: self.client.create_recordset(zone['id'], recordset_data))
+
+
class RootRecordsetsTests(BaseRecordsetsTest):
@classmethod
diff --git a/designate_tempest_plugin/tests/api/v2/test_zones.py b/designate_tempest_plugin/tests/api/v2/test_zones.py
index 62f188e..015010c 100644
--- a/designate_tempest_plugin/tests/api/v2/test_zones.py
+++ b/designate_tempest_plugin/tests/api/v2/test_zones.py
@@ -85,7 +85,7 @@
# TODO(kiall): We really want to assert that out newly created zone is
# present in the response.
- self.assertTrue(len(body['zones']) > 0)
+ self.assertGreater(len(body['zones']), 0)
@test.attr(type='smoke')
@test.idempotent_id('123f51cb-19d5-48a9-aacc-476742c02141')
diff --git a/designate_tempest_plugin/tests/api/v2/test_zones_exports.py b/designate_tempest_plugin/tests/api/v2/test_zones_exports.py
index c9350e6..05cb9e8 100644
--- a/designate_tempest_plugin/tests/api/v2/test_zones_exports.py
+++ b/designate_tempest_plugin/tests/api/v2/test_zones_exports.py
@@ -94,4 +94,4 @@
LOG.info('List zones exports')
_, body = self.client.list_zones_exports()
- self.assertTrue(len(body['exports']) > 0)
+ self.assertGreater(len(body['exports']), 0)
diff --git a/designate_tempest_plugin/tests/api/v2/test_zones_imports.py b/designate_tempest_plugin/tests/api/v2/test_zones_imports.py
index ff2d5ef..574d8b5 100644
--- a/designate_tempest_plugin/tests/api/v2/test_zones_imports.py
+++ b/designate_tempest_plugin/tests/api/v2/test_zones_imports.py
@@ -77,4 +77,4 @@
LOG.info('List zones imports')
_, body = self.client.list_zone_imports()
- self.assertTrue(len(body['imports']) > 0)
+ self.assertGreater(len(body['imports']), 0)
diff --git a/designate_tempest_plugin/tests/scenario/v2/test_zones.py b/designate_tempest_plugin/tests/scenario/v2/test_zones.py
index 6ee479f..6c5bf0e 100644
--- a/designate_tempest_plugin/tests/scenario/v2/test_zones.py
+++ b/designate_tempest_plugin/tests/scenario/v2/test_zones.py
@@ -13,11 +13,13 @@
# under the License.
from oslo_log import log as logging
from tempest import test
+from tempest import config
from tempest.lib import exceptions as lib_exc
from designate_tempest_plugin.tests import base
from designate_tempest_plugin.common import waiters
+
LOG = logging.getLogger(__name__)
@@ -84,6 +86,7 @@
@test.attr(type='slow')
@test.idempotent_id('ad8d1f5b-da66-46a0-bbee-14dc84a5d791')
+ @config.skip_unless_config('dns', 'nameservers')
def test_zone_create_propagates_to_nameservers(self):
LOG.info('Create a zone')
_, zone = self.client.create_zone()
@@ -94,6 +97,7 @@
@test.attr(type='slow')
@test.idempotent_id('d13d3095-c78f-4aae-8fe3-a74ccc335c84')
+ @config.skip_unless_config('dns', 'nameservers')
def test_zone_delete_propagates_to_nameservers(self):
LOG.info('Create a zone')
_, zone = self.client.create_zone()
diff --git a/requirements.txt b/requirements.txt
index 8ba92bf..9ec3008 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -4,4 +4,5 @@
dnspython!=1.13.0,>=1.12.0;python_version<'3.0' # http://www.dnspython.org/LICENSE
dnspython3>=1.12.0;python_version>='3.0' # http://www.dnspython.org/LICENSE
+ddt>=1.0.1 # MIT
tempest>=11.0.0 # Apache-2.0