Use TEST-NET-1 for most unit testing
Change-Id: I3707f263dca8ddfef7db9b765e6071220259b4bc
This commit is contained in:
parent
aacea51715
commit
69515a8df7
designate/tests
resources/sample_notifications/neutron
test_api/test_v2
test_central
test_mdns
test_schema
unit
@ -17,7 +17,7 @@
|
||||
"fixed_ip_address" : "172.16.59.10",
|
||||
"router_id" : "62c1fd2b-8149-4222-8d6b-e581c55e5264",
|
||||
"port_id" : "289ed46b-274c-444d-9fd4-bddf8acc7d7c",
|
||||
"floating_ip_address" : "192.168.5.201",
|
||||
"floating_ip_address" : "192.0.2.201",
|
||||
"id" : "f38ff2b6-cd4d-433e-8a9c-9e00dfc05b1e"
|
||||
}
|
||||
},
|
||||
|
@ -17,7 +17,7 @@
|
||||
"fixed_ip_address" : null,
|
||||
"router_id" : null,
|
||||
"port_id" : null,
|
||||
"floating_ip_address" : "192.168.5.201",
|
||||
"floating_ip_address" : "192.0.2.201",
|
||||
"id" : "f38ff2b6-cd4d-433e-8a9c-9e00dfc05b1e"
|
||||
}
|
||||
},
|
||||
|
@ -524,7 +524,7 @@ class ApiV2ZonesTest(ApiV2TestCase):
|
||||
def test_create_secondary(self):
|
||||
# Create a zone
|
||||
fixture = self.get_zone_fixture('SECONDARY', 0)
|
||||
fixture['masters'] = ["10.0.0.1"]
|
||||
fixture['masters'] = ["192.0.2.1"]
|
||||
|
||||
response = self.client.post_json('/zones/', fixture,
|
||||
headers={'X-Test-Role': 'member'})
|
||||
@ -567,8 +567,8 @@ class ApiV2ZonesTest(ApiV2TestCase):
|
||||
name='example.com.',
|
||||
type='SECONDARY',
|
||||
masters=objects.ZoneMasterList.from_list([
|
||||
{'host': '1.0.0.0', 'port': 69},
|
||||
{'host': '2.0.0.0', 'port': 69}
|
||||
{'host': '192.0.2.1', 'port': 69},
|
||||
{'host': '192.0.2.2', 'port': 69}
|
||||
])
|
||||
)
|
||||
zone.email = cfg.CONF['service:central'].managed_resource_email
|
||||
@ -576,7 +576,7 @@ class ApiV2ZonesTest(ApiV2TestCase):
|
||||
# Create a zone
|
||||
zone = self.central_service.create_zone(self.admin_context, zone)
|
||||
|
||||
masters = ['10.0.0.1', '10.0.0.2']
|
||||
masters = ['192.0.2.1', '192.0.2.2']
|
||||
|
||||
# Prepare an update body
|
||||
body = {'masters': masters}
|
||||
@ -604,7 +604,7 @@ class ApiV2ZonesTest(ApiV2TestCase):
|
||||
# Create a zone
|
||||
fixture = self.get_zone_fixture('SECONDARY', 0)
|
||||
fixture['email'] = cfg.CONF['service:central'].managed_resource_email
|
||||
fixture['masters'] = [{"host": "10.0.0.10", "port": 53}]
|
||||
fixture['masters'] = [{"host": "192.0.2.10", "port": 53}]
|
||||
|
||||
# Create a zone
|
||||
zone = self.create_zone(**fixture)
|
||||
|
@ -1411,7 +1411,7 @@ class CentralServiceTest(designate.tests.TestCase):
|
||||
# Create a zone
|
||||
fixture = self.get_zone_fixture('SECONDARY', 0)
|
||||
fixture['email'] = cfg.CONF['service:central'].managed_resource_email
|
||||
fixture['masters'] = [{"host": "10.0.0.10", "port": 53}]
|
||||
fixture['masters'] = [{"host": "192.0.2.10", "port": 53}]
|
||||
|
||||
# Create a zone
|
||||
secondary = self.create_zone(**fixture)
|
||||
@ -1430,7 +1430,7 @@ class CentralServiceTest(designate.tests.TestCase):
|
||||
# Create a zone
|
||||
fixture = self.get_zone_fixture('SECONDARY', 0)
|
||||
fixture['email'] = cfg.CONF['service:central'].managed_resource_email
|
||||
fixture['masters'] = [{"host": "10.0.0.10", "port": 53}]
|
||||
fixture['masters'] = [{"host": "192.0.2.10", "port": 53}]
|
||||
|
||||
# Create a zone
|
||||
secondary = self.create_zone(**fixture)
|
||||
@ -1448,7 +1448,7 @@ class CentralServiceTest(designate.tests.TestCase):
|
||||
# Create a zone
|
||||
fixture = self.get_zone_fixture('SECONDARY', 0)
|
||||
fixture['email'] = cfg.CONF['service:central'].managed_resource_email
|
||||
fixture['masters'] = [{"host": "10.0.0.10", "port": 53}]
|
||||
fixture['masters'] = [{"host": "192.0.2.10", "port": 53}]
|
||||
fixture['serial'] = 10
|
||||
|
||||
# Create a zone
|
||||
|
@ -125,7 +125,7 @@ class MdnsRequestHandlerTest(designate.tests.TestCase):
|
||||
def _get_secondary_zone(self, values=None, attributes=None,
|
||||
masters=None):
|
||||
attributes = attributes or []
|
||||
masters = masters or [{"host": "10.0.0.1", "port": 53}]
|
||||
masters = masters or [{"host": "192.0.2.1", "port": 53}]
|
||||
fixture = self.get_zone_fixture("SECONDARY", values=values)
|
||||
fixture['email'] = cfg.CONF['service:central'].managed_resource_email
|
||||
|
||||
@ -147,7 +147,7 @@ class MdnsRequestHandlerTest(designate.tests.TestCase):
|
||||
# DNS packet with NOTIFY opcode
|
||||
payload = "c38021000001000000000000076578616d706c6503636f6d0000060001"
|
||||
|
||||
master = "10.0.0.1"
|
||||
master = "192.0.2.1"
|
||||
zone = self._get_secondary_zone({"serial": 123})
|
||||
|
||||
# expected response is an error code NOERROR. The other fields are
|
||||
@ -184,7 +184,7 @@ class MdnsRequestHandlerTest(designate.tests.TestCase):
|
||||
# DNS packet with NOTIFY opcode
|
||||
payload = "c38021000001000000000000076578616d706c6503636f6d0000060001"
|
||||
|
||||
master = "10.0.0.1"
|
||||
master = "192.0.2.1"
|
||||
zone = self._get_secondary_zone({"serial": 123})
|
||||
|
||||
# expected response is an error code NOERROR. The other fields are
|
||||
@ -242,7 +242,7 @@ class MdnsRequestHandlerTest(designate.tests.TestCase):
|
||||
|
||||
request = dns.message.from_wire(binascii.a2b_hex(payload))
|
||||
request.environ = {
|
||||
'addr': ("10.0.0.2", 53),
|
||||
'addr': ("192.0.2.2", 53),
|
||||
'context': self.context
|
||||
}
|
||||
|
||||
@ -270,7 +270,7 @@ class MdnsRequestHandlerTest(designate.tests.TestCase):
|
||||
|
||||
request = dns.message.from_wire(binascii.a2b_hex(payload))
|
||||
request.environ = {
|
||||
'addr': ("10.0.0.2", 53),
|
||||
'addr': ("192.0.2.2", 53),
|
||||
'context': self.context
|
||||
}
|
||||
|
||||
@ -298,7 +298,7 @@ class MdnsRequestHandlerTest(designate.tests.TestCase):
|
||||
|
||||
request = dns.message.from_wire(binascii.a2b_hex(payload))
|
||||
request.environ = {
|
||||
'addr': ("10.0.0.2", 53),
|
||||
'addr': ("192.0.2.2", 53),
|
||||
'context': self.context
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,7 @@ class SchemaFormatTest(TestCase):
|
||||
valid_ipaddresses = [
|
||||
'0.0.0.1',
|
||||
'127.0.0.1',
|
||||
'10.0.0.1',
|
||||
'192.0.2.1',
|
||||
'192.0.2.2',
|
||||
]
|
||||
|
||||
|
@ -41,15 +41,15 @@ class AgentRequestHandlerTest(designate.tests.TestCase):
|
||||
dns.opcode.Opcode = private_codes.OpcodeWith14
|
||||
|
||||
def test_init(self):
|
||||
self.CONF.set_override('masters', ['192.168.0.1', '192.168.0.2'],
|
||||
self.CONF.set_override('masters', ['192.0.2.1', '192.0.2.2'],
|
||||
'service:agent')
|
||||
|
||||
hndlr = handler.RequestHandler()
|
||||
|
||||
self.assertEqual(
|
||||
[
|
||||
{'host': '192.168.0.1', 'port': 53},
|
||||
{'host': '192.168.0.2', 'port': 53}
|
||||
{'host': '192.0.2.1', 'port': 53},
|
||||
{'host': '192.0.2.2', 'port': 53}
|
||||
],
|
||||
hndlr.masters
|
||||
)
|
||||
|
@ -45,11 +45,11 @@ class AkamaiBackendTestCase(oslotest.base.BaseTestCase):
|
||||
'id': '4588652b-50e7-46b9-b688-a9bad40a873e',
|
||||
'type': 'akamai_v2',
|
||||
'masters': [
|
||||
{'host': '192.168.1.1', 'port': 53},
|
||||
{'host': '192.168.1.2', 'port': 35}
|
||||
{'host': '192.0.2.1', 'port': 53},
|
||||
{'host': '192.0.2.2', 'port': 35}
|
||||
],
|
||||
'options': [
|
||||
{'key': 'host', 'value': '192.168.2.3'},
|
||||
{'key': 'host', 'value': '192.0.2.3'},
|
||||
{'key': 'port', 'value': '53'},
|
||||
{'key': 'akamai_client_secret', 'value': 'client_secret'},
|
||||
{'key': 'akamai_host', 'value': 'host_value'},
|
||||
@ -108,7 +108,7 @@ class AkamaiBackendTestCase(oslotest.base.BaseTestCase):
|
||||
mock_post.assert_called_once_with(
|
||||
json={
|
||||
'comment': 'Created by Designate for Tenant %s' % project_id,
|
||||
'masters': ['192.168.1.1', '192.168.1.2'],
|
||||
'masters': ['192.0.2.1', '192.0.2.2'],
|
||||
'type': 'secondary', 'zone': 'example.com.'
|
||||
},
|
||||
params={
|
||||
@ -139,7 +139,7 @@ class AkamaiBackendTestCase(oslotest.base.BaseTestCase):
|
||||
mock_post.assert_called_once_with(
|
||||
json={
|
||||
'comment': 'Created by Designate for Tenant %s' % project_id,
|
||||
'masters': ['192.168.1.1', '192.168.1.2'],
|
||||
'masters': ['192.0.2.1', '192.0.2.2'],
|
||||
'type': 'secondary', 'zone': 'example.com.'
|
||||
},
|
||||
params={
|
||||
@ -173,7 +173,7 @@ class AkamaiBackendTestCase(oslotest.base.BaseTestCase):
|
||||
mock_post.assert_called_once_with(
|
||||
json={
|
||||
'comment': 'Created by Designate for Tenant %s' % project_id,
|
||||
'masters': ['192.168.1.1', '192.168.1.2'],
|
||||
'masters': ['192.0.2.1', '192.0.2.2'],
|
||||
'type': 'secondary',
|
||||
'zone': 'example.com.',
|
||||
'tsigKey': {
|
||||
@ -219,7 +219,7 @@ class AkamaiBackendTestCase(oslotest.base.BaseTestCase):
|
||||
mock_post.assert_called_once_with(
|
||||
json={
|
||||
'comment': 'Created by Designate for Tenant %s' % project_id,
|
||||
'masters': ['192.168.1.1', '192.168.1.2'],
|
||||
'masters': ['192.0.2.1', '192.0.2.2'],
|
||||
'type': 'secondary', 'zone': 'example.com.'
|
||||
},
|
||||
params={
|
||||
|
@ -43,13 +43,13 @@ class Bind9BackendTestCase(oslotest.base.BaseTestCase):
|
||||
'id': '4588652b-50e7-46b9-b688-a9bad40a873e',
|
||||
'type': 'bind9',
|
||||
'masters': [
|
||||
{'host': '192.168.1.1', 'port': 53},
|
||||
{'host': '192.168.1.2', 'port': 35}
|
||||
{'host': '192.0.2.1', 'port': 53},
|
||||
{'host': '192.0.2.2', 'port': 35}
|
||||
],
|
||||
'options': [
|
||||
{'key': 'host', 'value': '192.168.2.3'},
|
||||
{'key': 'host', 'value': '192.0.2.3'},
|
||||
{'key': 'port', 'value': '53'},
|
||||
{'key': 'rndc_host', 'value': '192.168.2.4'},
|
||||
{'key': 'rndc_host', 'value': '192.0.2.4'},
|
||||
{'key': 'rndc_port', 'value': '953'},
|
||||
{'key': 'rndc_bin_path', 'value': '/usr/sbin/rndc'},
|
||||
{'key': 'rndc_config_file', 'value': '/etc/rndc.conf'},
|
||||
@ -70,7 +70,7 @@ class Bind9BackendTestCase(oslotest.base.BaseTestCase):
|
||||
mock_execute.assert_called_with(
|
||||
[
|
||||
'addzone',
|
||||
'example.com { type slave; masters { 192.168.1.1 port 53; 192.168.1.2 port 35;}; file "slave.example.com.cca7908b-dad4-4c50-adba-fb67d4c556e8"; };' # noqa
|
||||
'example.com { type slave; masters { 192.0.2.1 port 53; 192.0.2.2 port 35;}; file "slave.example.com.cca7908b-dad4-4c50-adba-fb67d4c556e8"; };' # noqa
|
||||
]
|
||||
)
|
||||
|
||||
@ -82,7 +82,7 @@ class Bind9BackendTestCase(oslotest.base.BaseTestCase):
|
||||
mock_execute.assert_called_with(
|
||||
[
|
||||
'modzone',
|
||||
'example.com { type slave; masters { 192.168.1.1 port 53; 192.168.1.2 port 35;}; file "slave.example.com.cca7908b-dad4-4c50-adba-fb67d4c556e8"; };' # noqa
|
||||
'example.com { type slave; masters { 192.0.2.1 port 53; 192.0.2.2 port 35;}; file "slave.example.com.cca7908b-dad4-4c50-adba-fb67d4c556e8"; };' # noqa
|
||||
]
|
||||
)
|
||||
|
||||
@ -111,7 +111,7 @@ class Bind9BackendTestCase(oslotest.base.BaseTestCase):
|
||||
mock_execute.assert_called_with(
|
||||
[
|
||||
'addzone',
|
||||
'example.com in guest { type slave; masters { 192.168.1.2 port 35; 192.168.1.1 port 53;}; file "slave.example.com.cca7908b-dad4-4c50-adba-fb67d4c556e8"; };' # noqa
|
||||
'example.com in guest { type slave; masters { 192.0.2.2 port 35; 192.0.2.1 port 53;}; file "slave.example.com.cca7908b-dad4-4c50-adba-fb67d4c556e8"; };' # noqa
|
||||
]
|
||||
)
|
||||
|
||||
@ -186,7 +186,7 @@ class Bind9BackendTestCase(oslotest.base.BaseTestCase):
|
||||
def test_generate_rndc_base_call(self):
|
||||
self.assertEqual(
|
||||
[
|
||||
'/usr/sbin/rndc', '-s', '192.168.2.4', '-p', '953',
|
||||
'/usr/sbin/rndc', '-s', '192.0.2.4', '-p', '953',
|
||||
'-c', '/etc/rndc.conf', '-k', '/etc/rndc.key'
|
||||
],
|
||||
self.backend._generate_rndc_base_call()
|
||||
@ -194,7 +194,7 @@ class Bind9BackendTestCase(oslotest.base.BaseTestCase):
|
||||
|
||||
def test_generate_rndc_base_call_without_config_file(self):
|
||||
self.target['options'] = [
|
||||
{'key': 'rndc_host', 'value': '192.168.4.4'},
|
||||
{'key': 'rndc_host', 'value': '192.0.2.4'},
|
||||
{'key': 'rndc_port', 'value': '953'},
|
||||
{'key': 'rndc_bin_path', 'value': '/usr/sbin/rndc'},
|
||||
{'key': 'rndc_key_file', 'value': '/etc/rndc.key'},
|
||||
@ -206,7 +206,7 @@ class Bind9BackendTestCase(oslotest.base.BaseTestCase):
|
||||
|
||||
self.assertEqual(
|
||||
[
|
||||
'/usr/sbin/rndc', '-s', '192.168.4.4', '-p', '953',
|
||||
'/usr/sbin/rndc', '-s', '192.0.2.4', '-p', '953',
|
||||
'-k', '/etc/rndc.key'
|
||||
],
|
||||
backend._generate_rndc_base_call()
|
||||
@ -214,7 +214,7 @@ class Bind9BackendTestCase(oslotest.base.BaseTestCase):
|
||||
|
||||
def test_generate_rndc_base_call_without_key_file(self):
|
||||
self.target['options'] = [
|
||||
{'key': 'rndc_host', 'value': '192.168.3.4'},
|
||||
{'key': 'rndc_host', 'value': '192.0.2.4'},
|
||||
{'key': 'rndc_port', 'value': '953'},
|
||||
{'key': 'rndc_bin_path', 'value': '/usr/sbin/rndc'},
|
||||
{'key': 'rndc_config_file', 'value': '/etc/rndc.conf'},
|
||||
@ -226,7 +226,7 @@ class Bind9BackendTestCase(oslotest.base.BaseTestCase):
|
||||
|
||||
self.assertEqual(
|
||||
[
|
||||
'/usr/sbin/rndc', '-s', '192.168.3.4', '-p', '953',
|
||||
'/usr/sbin/rndc', '-s', '192.0.2.4', '-p', '953',
|
||||
'-c', '/etc/rndc.conf'
|
||||
],
|
||||
backend._generate_rndc_base_call()
|
||||
@ -239,7 +239,7 @@ class Bind9BackendTestCase(oslotest.base.BaseTestCase):
|
||||
self.backend._execute_rndc(rndc_op)
|
||||
|
||||
mock_execute.assert_called_with(
|
||||
'/usr/sbin/rndc', '-s', '192.168.2.4', '-p', '953',
|
||||
'/usr/sbin/rndc', '-s', '192.0.2.4', '-p', '953',
|
||||
'-c', '/etc/rndc.conf', '-k', '/etc/rndc.key',
|
||||
'delzone', 'example.com ', timeout=None
|
||||
)
|
||||
@ -252,7 +252,7 @@ class Bind9BackendTestCase(oslotest.base.BaseTestCase):
|
||||
self.backend._execute_rndc(rndc_op)
|
||||
|
||||
mock_execute.assert_called_with(
|
||||
'/usr/sbin/rndc', '-s', '192.168.2.4', '-p', '953',
|
||||
'/usr/sbin/rndc', '-s', '192.0.2.4', '-p', '953',
|
||||
'-c', '/etc/rndc.conf', '-k', '/etc/rndc.key',
|
||||
'delzone', 'example.com ', timeout=10
|
||||
)
|
||||
@ -264,7 +264,7 @@ class Bind9BackendTestCase(oslotest.base.BaseTestCase):
|
||||
self.backend._rndc_timeout = 10
|
||||
|
||||
mock_execute.side_effect = subprocess.TimeoutExpired([
|
||||
'/usr/sbin/rndc', '-s', '192.168.2.4', '-p', '953',
|
||||
'/usr/sbin/rndc', '-s', '192.0.2.4', '-p', '953',
|
||||
'-c', '/etc/rndc.conf', '-k', '/etc/rndc.key',
|
||||
'delzone', 'example.com '], 10)
|
||||
|
||||
|
@ -23,7 +23,7 @@ from designate.backend import impl_dynect
|
||||
from designate import context
|
||||
from designate import objects
|
||||
|
||||
MASTERS = ["10.0.0.1"]
|
||||
MASTERS = ["192.0.2.1"]
|
||||
CONTACT = 'jdoe@myco.biz'
|
||||
|
||||
LOGIN_SUCCESS = {
|
||||
|
@ -40,8 +40,8 @@ class FakeBackendTestCase(oslotest.base.BaseTestCase):
|
||||
'id': '4588652b-50e7-46b9-b688-a9bad40a873e',
|
||||
'type': 'fake',
|
||||
'masters': [
|
||||
{'host': '192.168.1.1', 'port': 53},
|
||||
{'host': '192.168.1.2', 'port': 35}
|
||||
{'host': '192.0.2.1', 'port': 53},
|
||||
{'host': '192.0.2.2', 'port': 35}
|
||||
],
|
||||
'options': [
|
||||
],
|
||||
|
@ -60,7 +60,7 @@ class MdnsHandleTest(oslotest.base.BaseTestCase):
|
||||
id='e2bed4dc-9d01-11e4-89d3-123b93f75cba',
|
||||
serial=2,
|
||||
masters=objects.ZoneMasterList.from_list([
|
||||
{'host': '1.0.0.0', 'port': 53},
|
||||
{'host': '192.0.2.1', 'port': 53},
|
||||
])
|
||||
)
|
||||
mock_query.return_value = [
|
||||
@ -70,7 +70,7 @@ class MdnsHandleTest(oslotest.base.BaseTestCase):
|
||||
request = dns.message.make_query(
|
||||
'www.example.org.', dns.rdatatype.SOA
|
||||
)
|
||||
request.environ = dict(addr=['1.0.0.0'], context=self.context)
|
||||
request.environ = dict(addr=['192.0.2.1'], context=self.context)
|
||||
|
||||
response = self.handler._handle_notify(request)
|
||||
|
||||
@ -78,7 +78,7 @@ class MdnsHandleTest(oslotest.base.BaseTestCase):
|
||||
|
||||
self.assertIn(
|
||||
'Scheduling AXFR for e2bed4dc-9d01-11e4-89d3-123b93f75cba '
|
||||
'from 1.0.0.0:53',
|
||||
'from 192.0.2.1:53',
|
||||
self.stdlog.logger.output
|
||||
)
|
||||
|
||||
@ -88,7 +88,7 @@ class MdnsHandleTest(oslotest.base.BaseTestCase):
|
||||
id='e2bed4dc-9d01-11e4-89d3-123b93f75cba',
|
||||
serial=1,
|
||||
masters=objects.ZoneMasterList.from_list([
|
||||
{'host': '1.0.0.0', 'port': 53},
|
||||
{'host': '192.0.2.1', 'port': 53},
|
||||
])
|
||||
)
|
||||
mock_query.return_value = [
|
||||
@ -98,7 +98,7 @@ class MdnsHandleTest(oslotest.base.BaseTestCase):
|
||||
request = dns.message.make_query(
|
||||
'www.example.org.', dns.rdatatype.SOA
|
||||
)
|
||||
request.environ = dict(addr=['1.0.0.0'], context=self.context)
|
||||
request.environ = dict(addr=['192.0.2.1'], context=self.context)
|
||||
|
||||
response = self.handler._handle_notify(request)
|
||||
|
||||
@ -136,7 +136,7 @@ class MdnsHandleTest(oslotest.base.BaseTestCase):
|
||||
def test_notify_no_master_addr(self):
|
||||
self.storage.find_zone.return_value = objects.Zone(
|
||||
masters=objects.ZoneMasterList.from_list([
|
||||
{'host': '1.0.0.0', 'port': 53},
|
||||
{'host': '192.0.2.1', 'port': 53},
|
||||
])
|
||||
)
|
||||
|
||||
|
@ -125,12 +125,12 @@ class NeutronNetworkAPITest(oslotest.base.BaseTestCase):
|
||||
driver.network.ips.return_value = [
|
||||
{
|
||||
'id': '123',
|
||||
'floating_ip_address': '192.168.0.100',
|
||||
'floating_ip_address': '192.0.2.100',
|
||||
'region': 'RegionOne'
|
||||
},
|
||||
{
|
||||
'id': '456',
|
||||
'floating_ip_address': '192.168.0.200',
|
||||
'floating_ip_address': '192.0.2.200',
|
||||
'region': 'RegionOne'
|
||||
},
|
||||
]
|
||||
|
@ -104,7 +104,7 @@ class DesignateAdapterTest(oslotest.base.BaseTestCase):
|
||||
'Provided object does not match schema. '
|
||||
'Keys \\[\'address\'\\] are not valid for test_obj',
|
||||
adapters.DesignateAdapter.parse,
|
||||
'TEST_API', {'address': '192.168.0.1'}, DesignateTestObject(),
|
||||
'TEST_API', {'address': '192.0.2.1'}, DesignateTestObject(),
|
||||
)
|
||||
|
||||
def test_get_object_adapter(self):
|
||||
|
@ -27,12 +27,12 @@ class RRDataATest(oslotest.base.BaseTestCase):
|
||||
recordset = objects.RecordSet(
|
||||
name='www.example.test.', type='A',
|
||||
records=objects.RecordList(objects=[
|
||||
objects.Record(data='192.168.0.1'),
|
||||
objects.Record(data='192.0.2.1'),
|
||||
])
|
||||
)
|
||||
recordset.validate()
|
||||
self.assertEqual(
|
||||
"<Record id:'None' recordset_id:'None' data:'192.168.0.1'>",
|
||||
"<Record id:'None' recordset_id:'None' data:'192.0.2.1'>",
|
||||
repr(recordset.records[0])
|
||||
)
|
||||
|
||||
@ -40,7 +40,7 @@ class RRDataATest(oslotest.base.BaseTestCase):
|
||||
recordset = objects.RecordSet(
|
||||
name='www.example.test.', type='A',
|
||||
records=objects.RecordList(objects=[
|
||||
objects.Record(data='192.168.0.1'),
|
||||
objects.Record(data='192.0.2.1'),
|
||||
])
|
||||
)
|
||||
recordset.validate()
|
||||
@ -75,7 +75,7 @@ class RRDataATest(oslotest.base.BaseTestCase):
|
||||
recordset = objects.RecordSet(
|
||||
name='www.example.test.', type='A',
|
||||
records=objects.RecordList(objects=[
|
||||
objects.Record(data='10.0.001.1'),
|
||||
objects.Record(data='192.0.002.1'),
|
||||
])
|
||||
)
|
||||
self.assertRaisesRegex(
|
||||
|
@ -32,7 +32,7 @@ class RRDataAAAATest(oslotest.base.BaseTestCase):
|
||||
recordset = objects.RecordSet(
|
||||
name='www.example.test.', type='AAAA',
|
||||
records=objects.RecordList(objects=[
|
||||
objects.Record(data='192.168.0.1'),
|
||||
objects.Record(data='192.0.2.1'),
|
||||
])
|
||||
)
|
||||
self.assertRaisesRegex(
|
||||
|
@ -49,17 +49,17 @@ class ZoneTest(oslotest.base.BaseTestCase):
|
||||
def test_masters(self):
|
||||
zone = objects.Zone(
|
||||
masters=objects.ZoneMasterList.from_list([
|
||||
{'host': '1.0.0.0', 'port': 53}
|
||||
{'host': '192.0.2.1', 'port': 53}
|
||||
])
|
||||
)
|
||||
self.assertEqual(
|
||||
[{'host': '1.0.0.0', 'port': 53}], zone.masters.to_list())
|
||||
[{'host': '192.0.2.1', 'port': 53}], zone.masters.to_list())
|
||||
|
||||
def test_masters_2(self):
|
||||
zone = objects.Zone(
|
||||
masters=objects.ZoneMasterList.from_list([
|
||||
{'host': '1.0.0.0'},
|
||||
{'host': '2.0.0.0'}
|
||||
{'host': '192.0.2.1'},
|
||||
{'host': '192.0.2.2'}
|
||||
])
|
||||
)
|
||||
self.assertEqual(2, len(zone.masters))
|
||||
@ -67,18 +67,18 @@ class ZoneTest(oslotest.base.BaseTestCase):
|
||||
def test_get_master_by_ip(self):
|
||||
zone = objects.Zone(
|
||||
masters=objects.ZoneMasterList.from_list([
|
||||
{'host': '1.0.0.0', 'port': 53},
|
||||
{'host': '2.0.0.0', 'port': 53}
|
||||
{'host': '192.0.2.1', 'port': 53},
|
||||
{'host': '192.0.2.2', 'port': 53}
|
||||
])
|
||||
)
|
||||
m = zone.get_master_by_ip('2.0.0.0').to_data()
|
||||
m = zone.get_master_by_ip('192.0.2.2').to_data()
|
||||
|
||||
self.assertEqual('2.0.0.0:53', m)
|
||||
self.assertEqual('192.0.2.2:53', m)
|
||||
|
||||
@unittest.expectedFailure # bug: zone.masters is not iterable
|
||||
def test_get_master_by_ip_none(self):
|
||||
zone = objects.Zone()
|
||||
master = zone.get_master_by_ip('2.0.0.0')
|
||||
master = zone.get_master_by_ip('192.0.2.2')
|
||||
self.assertFalse(master)
|
||||
|
||||
def test_validate(self):
|
||||
@ -97,7 +97,7 @@ class ZoneTest(oslotest.base.BaseTestCase):
|
||||
|
||||
def test_validate_primary_with_masters(self):
|
||||
masters = objects.ZoneMasterList()
|
||||
masters.append(objects.ZoneMaster.from_data("10.0.0.1:53"))
|
||||
masters.append(objects.ZoneMaster.from_data("192.0.2.1:53"))
|
||||
zone = objects.Zone(
|
||||
name='example.com.',
|
||||
type='PRIMARY',
|
||||
@ -123,7 +123,7 @@ class ZoneTest(oslotest.base.BaseTestCase):
|
||||
|
||||
def test_validate_secondary_with_email(self):
|
||||
masters = objects.ZoneMasterList()
|
||||
masters.append(objects.ZoneMaster.from_data("10.0.0.1:53"))
|
||||
masters.append(objects.ZoneMaster.from_data("192.0.2.1:53"))
|
||||
zone = objects.Zone(
|
||||
name='example.com.',
|
||||
type='SECONDARY',
|
||||
@ -138,7 +138,7 @@ class ZoneTest(oslotest.base.BaseTestCase):
|
||||
|
||||
def test_validate_secondary_with_ttl(self):
|
||||
masters = objects.ZoneMasterList()
|
||||
masters.append(objects.ZoneMaster.from_data("10.0.0.1:53"))
|
||||
masters.append(objects.ZoneMaster.from_data("192.0.2.1:53"))
|
||||
zone = objects.Zone(
|
||||
name='example.com.',
|
||||
type='SECONDARY',
|
||||
|
@ -1056,7 +1056,7 @@ class CentralZoneTestCase(CentralBasic):
|
||||
name='example.org.',
|
||||
tenant_id='2',
|
||||
type='SECONDARY',
|
||||
masters=[RoObject(host='10.0.0.1', port=53)],
|
||||
masters=[RoObject(host='192.0.2.1', port=53)],
|
||||
serial=1,
|
||||
)
|
||||
with fx_worker:
|
||||
|
@ -171,7 +171,7 @@ class AuditNotificationTest(unittest.TestCase):
|
||||
)
|
||||
|
||||
rrset.records = objects.RecordList.from_list(
|
||||
[{'data': '192.168.1.1'}])
|
||||
[{'data': '192.0.2.1'}])
|
||||
|
||||
result = rrset
|
||||
event = 'dns.recordset.create'
|
||||
@ -180,7 +180,7 @@ class AuditNotificationTest(unittest.TestCase):
|
||||
|
||||
expected = [{
|
||||
'changed_field': 'records',
|
||||
'new_data': '192.168.1.1',
|
||||
'new_data': '192.0.2.1',
|
||||
'old_data': '',
|
||||
'recordset_name': 'foo.example.com.',
|
||||
'zone_id': None,
|
||||
@ -200,7 +200,7 @@ class AuditNotificationTest(unittest.TestCase):
|
||||
)
|
||||
|
||||
rrset.records = objects.RecordList.from_list(
|
||||
[{'data': '192.168.1.1'}])
|
||||
[{'data': '192.0.2.1'}])
|
||||
|
||||
result = rrset
|
||||
event = 'dns.recordset.create'
|
||||
@ -209,7 +209,7 @@ class AuditNotificationTest(unittest.TestCase):
|
||||
|
||||
expected = [{
|
||||
'changed_field': 'records',
|
||||
'new_data': '192.168.1.1',
|
||||
'new_data': '192.0.2.1',
|
||||
'old_data': '',
|
||||
'recordset_name': 'foo.example.com.',
|
||||
'zone_id': AuditNotificationTest.zone__id,
|
||||
@ -224,13 +224,13 @@ class AuditNotificationTest(unittest.TestCase):
|
||||
name='foo.example.com.',
|
||||
type='PRIMARY',
|
||||
records=objects.RecordList.from_list(
|
||||
[{'data': '192.168.1.1'}]),
|
||||
[{'data': '192.0.2.1'}]),
|
||||
zone_id=AuditNotificationTest.zone__id,
|
||||
zone_name='example.com.'
|
||||
)
|
||||
|
||||
rrset.records = objects.RecordList.from_list(
|
||||
[{'data': '192.168.1.2'}])
|
||||
[{'data': '192.0.2.2'}])
|
||||
|
||||
result = rrset
|
||||
event = 'dns.recordset.update'
|
||||
@ -239,8 +239,8 @@ class AuditNotificationTest(unittest.TestCase):
|
||||
|
||||
expected = [{
|
||||
'changed_field': 'records',
|
||||
'new_data': '192.168.1.2',
|
||||
'old_data': '192.168.1.1',
|
||||
'new_data': '192.0.2.2',
|
||||
'old_data': '192.0.2.1',
|
||||
'recordset_name': 'foo.example.com.',
|
||||
'zone_id': AuditNotificationTest.zone__id,
|
||||
'zone_name': 'example.com.'
|
||||
@ -254,7 +254,7 @@ class AuditNotificationTest(unittest.TestCase):
|
||||
name='foo.example.com.',
|
||||
type='PRIMARY',
|
||||
records=objects.RecordList.from_list(
|
||||
[{'data': '192.168.1.1'}]),
|
||||
[{'data': '192.0.2.1'}]),
|
||||
zone_id=AuditNotificationTest.zone__id,
|
||||
zone_name='example.com.',
|
||||
ttl=300
|
||||
|
@ -92,8 +92,8 @@ class TestDoAfxr(oslotest.base.BaseTestCase):
|
||||
mock_from_xfr.return_value = 'raw_zone'
|
||||
|
||||
masters = [
|
||||
{'host': '192.168.0.1', 'port': 53},
|
||||
{'host': '192.168.0.2', 'port': 53},
|
||||
{'host': '192.0.2.1', 'port': 53},
|
||||
{'host': '192.0.2.2', 'port': 53},
|
||||
]
|
||||
|
||||
self.assertEqual(
|
||||
@ -122,10 +122,10 @@ class TestDoAfxr(oslotest.base.BaseTestCase):
|
||||
mock_from_xfr.side_effect = eventlet.Timeout()
|
||||
|
||||
masters = [
|
||||
{'host': '192.168.0.1', 'port': 53},
|
||||
{'host': '192.168.0.2', 'port': 53},
|
||||
{'host': '192.168.0.3', 'port': 53},
|
||||
{'host': '192.168.0.4', 'port': 53},
|
||||
{'host': '192.0.2.1', 'port': 53},
|
||||
{'host': '192.0.2.2', 'port': 53},
|
||||
{'host': '192.0.2.3', 'port': 53},
|
||||
{'host': '192.0.2.4', 'port': 53},
|
||||
]
|
||||
|
||||
self.assertRaises(
|
||||
@ -143,7 +143,7 @@ class TestDoAfxr(oslotest.base.BaseTestCase):
|
||||
mock_from_xfr.side_effect = dns.exception.FormError()
|
||||
|
||||
masters = [
|
||||
{'host': '192.168.0.1', 'port': 53},
|
||||
{'host': '192.0.2.1', 'port': 53},
|
||||
]
|
||||
|
||||
self.assertRaises(
|
||||
@ -160,7 +160,7 @@ class TestDoAfxr(oslotest.base.BaseTestCase):
|
||||
mock_from_xfr.side_effect = socket.error()
|
||||
|
||||
masters = [
|
||||
{'host': '192.168.0.1', 'port': 53},
|
||||
{'host': '192.0.2.1', 'port': 53},
|
||||
]
|
||||
|
||||
self.assertRaises(
|
||||
@ -177,7 +177,7 @@ class TestDoAfxr(oslotest.base.BaseTestCase):
|
||||
mock_from_xfr.side_effect = Exception()
|
||||
|
||||
masters = [
|
||||
{'host': '192.168.0.1', 'port': 53},
|
||||
{'host': '192.0.2.1', 'port': 53},
|
||||
]
|
||||
|
||||
self.assertRaises(
|
||||
|
@ -231,7 +231,7 @@ class TestService(oslotest.base.BaseTestCase):
|
||||
pool = mock.Mock()
|
||||
pool.also_notifies = mock.MagicMock()
|
||||
pool.also_notifies.__iter__.return_value = [
|
||||
mock.Mock(host='192.168.1.1', port=53),
|
||||
mock.Mock(host='192.0.2.1', port=53),
|
||||
]
|
||||
self.service.get_pool.return_value = pool
|
||||
self.zone_params = {}
|
||||
|
Loading…
x
Reference in New Issue
Block a user