Merge "Add data driven RecordSet tests"
This commit is contained in:
commit
1177796620
57
designate_tempest_plugin/tests/api/v2/recordset_data.json
Normal file
57
designate_tempest_plugin/tests/api/v2/recordset_data.json
Normal file
@ -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"]
|
||||
}
|
||||
}
|
@ -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."]
|
||||
}
|
||||
}
|
@ -15,6 +15,7 @@ from oslo_log import log as logging
|
||||
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 @@ class BaseRecordsetsTest(base.BaseDnsV2Test):
|
||||
'type']
|
||||
|
||||
|
||||
@ddt.ddt
|
||||
class RecordsetsTest(BaseRecordsetsTest):
|
||||
@classmethod
|
||||
def setup_clients(cls):
|
||||
@ -134,6 +136,40 @@ class RecordsetsTest(BaseRecordsetsTest):
|
||||
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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user