Use test addresses for all unit testing
Change-Id: I84fcb483a8d8cf50d7c6b7aa0b75c177f0b86c3d
This commit is contained in:
parent
0b9635ddec
commit
825e01a359
@ -92,7 +92,7 @@
|
||||
"_context_timestamp": "2012-11-03T17:54:27.320555",
|
||||
"_context_read_deleted": "no",
|
||||
"_context_user_id": "953f8394fa044302b7d42f47228e427d",
|
||||
"_context_remote_address": "127.0.0.1",
|
||||
"_context_remote_address": "192.0.2.1",
|
||||
"publisher_id": "compute.stack01",
|
||||
"payload": {
|
||||
"state_description": "",
|
||||
|
@ -92,7 +92,7 @@
|
||||
"_context_timestamp": "2012-11-03T17:54:27.320555",
|
||||
"_context_read_deleted": "no",
|
||||
"_context_user_id": "953f8394fa044302b7d42f47228e427d",
|
||||
"_context_remote_address": "127.0.0.1",
|
||||
"_context_remote_address": "192.0.2.1",
|
||||
"publisher_id": "compute.stack01",
|
||||
"payload": {
|
||||
"state_description": "",
|
||||
|
@ -92,7 +92,7 @@
|
||||
"_context_timestamp": "2012-11-03T17:54:27.320555",
|
||||
"_context_read_deleted": "no",
|
||||
"_context_user_id": "953f8394fa044302b7d42f47228e427d",
|
||||
"_context_remote_address": "127.0.0.1",
|
||||
"_context_remote_address": "192.0.2.1",
|
||||
"publisher_id": "compute.stack01",
|
||||
"payload": {
|
||||
"state_description": "scheduling",
|
||||
|
@ -92,7 +92,7 @@
|
||||
"_context_timestamp": "2012-11-03T18:01:59.435020",
|
||||
"_context_read_deleted": "no",
|
||||
"_context_user_id": "953f8394fa044302b7d42f47228e427d",
|
||||
"_context_remote_address": "127.0.0.1",
|
||||
"_context_remote_address": "192.0.2.1",
|
||||
"publisher_id": "compute.stack01",
|
||||
"payload": {
|
||||
"state_description": "",
|
||||
|
@ -92,7 +92,7 @@
|
||||
"_context_timestamp": "2012-11-03T18:01:59.435020",
|
||||
"_context_read_deleted": "no",
|
||||
"_context_user_id": "953f8394fa044302b7d42f47228e427d",
|
||||
"_context_remote_address": "127.0.0.1",
|
||||
"_context_remote_address": "192.0.2.1",
|
||||
"publisher_id": "compute.stack01",
|
||||
"payload": {
|
||||
"state_description": "",
|
||||
|
@ -92,7 +92,7 @@
|
||||
"_context_timestamp": "2012-11-03T18:01:59.435020",
|
||||
"_context_read_deleted": "no",
|
||||
"_context_user_id": "953f8394fa044302b7d42f47228e427d",
|
||||
"_context_remote_address": "127.0.0.1",
|
||||
"_context_remote_address": "192.0.2.1",
|
||||
"publisher_id": "compute.stack01",
|
||||
"payload": {
|
||||
"state_description": "",
|
||||
|
@ -92,7 +92,7 @@
|
||||
"_context_timestamp": "2012-11-03T18:01:15.615906",
|
||||
"_context_read_deleted": "no",
|
||||
"_context_user_id": "953f8394fa044302b7d42f47228e427d",
|
||||
"_context_remote_address": "127.0.0.1",
|
||||
"_context_remote_address": "192.0.2.1",
|
||||
"publisher_id": "network.stack01",
|
||||
"payload": {
|
||||
"project_id": "33a88272e06a49c1a0f653abc374b56b",
|
||||
|
@ -92,7 +92,7 @@
|
||||
"_context_timestamp": "2012-11-03T18:01:30.414284",
|
||||
"_context_read_deleted": "no",
|
||||
"_context_user_id": "953f8394fa044302b7d42f47228e427d",
|
||||
"_context_remote_address": "127.0.0.1",
|
||||
"_context_remote_address": "192.0.2.1",
|
||||
"publisher_id": "network.stack01",
|
||||
"payload": {
|
||||
"project_id": "33a88272e06a49c1a0f653abc374b56b",
|
||||
|
@ -92,7 +92,7 @@
|
||||
"_context_timestamp": "2012-11-03T18:01:49.584191",
|
||||
"_context_read_deleted": "no",
|
||||
"_context_user_id": "953f8394fa044302b7d42f47228e427d",
|
||||
"_context_remote_address": "127.0.0.1",
|
||||
"_context_remote_address": "192.0.2.1",
|
||||
"publisher_id": "network.stack01",
|
||||
"payload": {
|
||||
"project_id": "33a88272e06a49c1a0f653abc374b56b",
|
||||
|
@ -92,7 +92,7 @@
|
||||
"_context_timestamp": "2012-11-03T18:01:41.229276",
|
||||
"_context_read_deleted": "no",
|
||||
"_context_user_id": "953f8394fa044302b7d42f47228e427d",
|
||||
"_context_remote_address": "127.0.0.1",
|
||||
"_context_remote_address": "192.0.2.1",
|
||||
"publisher_id": "network.stack01",
|
||||
"payload": {
|
||||
"project_id": "33a88272e06a49c1a0f653abc374b56b",
|
||||
|
@ -92,7 +92,7 @@
|
||||
"_context_timestamp": "2012-11-03T17:54:27.320555",
|
||||
"_context_read_deleted": "no",
|
||||
"_context_user_id": "953f8394fa044302b7d42f47228e427d",
|
||||
"_context_remote_address": "127.0.0.1",
|
||||
"_context_remote_address": "192.0.2.1",
|
||||
"publisher_id": "scheduler.stack01",
|
||||
"payload": {
|
||||
"request_spec": {
|
||||
|
@ -92,7 +92,7 @@
|
||||
"_context_timestamp": "2012-11-03T17:54:27.320555",
|
||||
"_context_read_deleted": "no",
|
||||
"_context_user_id": "953f8394fa044302b7d42f47228e427d",
|
||||
"_context_remote_address": "127.0.0.1",
|
||||
"_context_remote_address": "192.0.2.1",
|
||||
"publisher_id": "scheduler.stack01",
|
||||
"payload": {
|
||||
"instance_id": "3e301a55-fbbe-478d-92d0-eefabf135c38",
|
||||
|
@ -92,7 +92,7 @@
|
||||
"_context_timestamp": "2012-11-03T17:54:27.320555",
|
||||
"_context_read_deleted": "no",
|
||||
"_context_user_id": "953f8394fa044302b7d42f47228e427d",
|
||||
"_context_remote_address": "127.0.0.1",
|
||||
"_context_remote_address": "192.0.2.1",
|
||||
"publisher_id": "scheduler.stack01",
|
||||
"payload": {
|
||||
"request_spec": {
|
||||
|
@ -3184,8 +3184,8 @@ class CentralServiceTest(designate.tests.TestCase):
|
||||
name='www.%s' % zone.name,
|
||||
type='A',
|
||||
records=objects.RecordList(objects=[
|
||||
objects.Record(data='127.0.0.1'),
|
||||
objects.Record(data='127.0.0.2'),
|
||||
objects.Record(data='192.0.2.1'),
|
||||
objects.Record(data='203.0.113.2'),
|
||||
]),
|
||||
)
|
||||
|
||||
@ -3896,7 +3896,7 @@ class CentralServiceTest(designate.tests.TestCase):
|
||||
recordset.records = [record]
|
||||
recordset.ttl = 3600
|
||||
fip = {
|
||||
'address': '127.0.0.1',
|
||||
'address': '192.0.2.1',
|
||||
'id': '1',
|
||||
'region': 'region',
|
||||
}
|
||||
@ -3904,11 +3904,11 @@ class CentralServiceTest(designate.tests.TestCase):
|
||||
self.admin_context, fip, record, zone, recordset
|
||||
)
|
||||
self.assertEqual('srv1.example.com.', result.ptrdname)
|
||||
self.assertEqual('127.0.0.1', result.address)
|
||||
self.assertEqual('192.0.2.1', result.address)
|
||||
|
||||
def test_create_floating_ip_with_no_record(self):
|
||||
fip = {
|
||||
'address': '127.0.0.1',
|
||||
'address': '192.0.2.1',
|
||||
'id': '1',
|
||||
'region': 'region',
|
||||
}
|
||||
@ -3916,7 +3916,7 @@ class CentralServiceTest(designate.tests.TestCase):
|
||||
|
||||
def test_create_floating_ip_zone_not_found(self):
|
||||
fip = {
|
||||
'address': '127.0.0.1',
|
||||
'address': '192.0.2.1',
|
||||
'id': '1',
|
||||
'region': 'region',
|
||||
}
|
||||
|
@ -903,7 +903,7 @@ class SqlalchemyStorageTest(TestCase):
|
||||
objects=[objects.ZoneAttribute(key='foo', value='bar')]
|
||||
)
|
||||
zone.masters = objects.ZoneMasterList(
|
||||
objects=[objects.ZoneMaster(host='127.0.0.1', port=80)]
|
||||
objects=[objects.ZoneMaster(host='192.0.2.1', port=80)]
|
||||
)
|
||||
|
||||
# Perform the update
|
||||
@ -1563,13 +1563,13 @@ class SqlalchemyStorageTest(TestCase):
|
||||
def test_find_records_criterion_wildcard(self):
|
||||
zone = self.create_zone()
|
||||
|
||||
records = [objects.Record.from_dict({'data': '127.0.0.1'})]
|
||||
records = [objects.Record.from_dict({'data': '192.0.2.1'})]
|
||||
recordset = self.create_recordset(zone, type='A', records=records)
|
||||
|
||||
criterion = dict(
|
||||
zone_id=zone['id'],
|
||||
recordset_id=recordset['id'],
|
||||
data='%.0.0.1',
|
||||
data='%.0.2.1',
|
||||
)
|
||||
|
||||
results = self.storage.find_records(self.admin_context, criterion)
|
||||
@ -2906,7 +2906,7 @@ class SqlalchemyStorageTest(TestCase):
|
||||
# Update the pool_target
|
||||
pool_target.description = 'Two'
|
||||
pool_target.masters = objects.PoolTargetMasterList(
|
||||
objects=[objects.PoolTargetMaster(host='127.0.0.1', port=80)]
|
||||
objects=[objects.PoolTargetMaster(host='192.0.2.1', port=80)]
|
||||
)
|
||||
pool_target.options = objects.PoolTargetOptionList(
|
||||
objects=[objects.PoolTargetOption(key='foo', value='bar')]
|
||||
@ -3006,7 +3006,7 @@ class SqlalchemyStorageTest(TestCase):
|
||||
|
||||
target = self.storage.create_pool_target_master(
|
||||
self.admin_context, pool_target['id'],
|
||||
objects.PoolTargetMaster(host='127.0.0.1', port=80)
|
||||
objects.PoolTargetMaster(host='192.0.2.1', port=80)
|
||||
)
|
||||
|
||||
result = self.storage._find_pool_target_masters(
|
||||
@ -3020,7 +3020,7 @@ class SqlalchemyStorageTest(TestCase):
|
||||
|
||||
target = self.storage.create_pool_target_master(
|
||||
self.admin_context, pool_target['id'],
|
||||
objects.PoolTargetMaster(host='127.0.0.1', port=80)
|
||||
objects.PoolTargetMaster(host='192.0.2.1', port=80)
|
||||
)
|
||||
|
||||
target.port = 443
|
||||
@ -3037,7 +3037,7 @@ class SqlalchemyStorageTest(TestCase):
|
||||
|
||||
target = self.storage.create_pool_target_master(
|
||||
self.admin_context, pool_target['id'],
|
||||
objects.PoolTargetMaster(host='127.0.0.1', port=80)
|
||||
objects.PoolTargetMaster(host='192.0.2.1', port=80)
|
||||
)
|
||||
|
||||
self.storage.delete_pool_target_master(
|
||||
@ -3102,7 +3102,7 @@ class SqlalchemyStorageTest(TestCase):
|
||||
|
||||
zone_master = self.storage.create_zone_master(
|
||||
self.admin_context, zone['id'],
|
||||
objects.ZoneMaster(host='127.0.0.1', port='80')
|
||||
objects.ZoneMaster(host='192.0.2.1', port='80')
|
||||
)
|
||||
|
||||
result = self.storage._find_zone_masters(
|
||||
@ -3115,7 +3115,7 @@ class SqlalchemyStorageTest(TestCase):
|
||||
|
||||
zone_master = self.storage.create_zone_master(
|
||||
self.admin_context, zone['id'],
|
||||
objects.ZoneMaster(host='127.0.0.1', port='80')
|
||||
objects.ZoneMaster(host='192.0.2.1', port='80')
|
||||
)
|
||||
|
||||
zone_master.port = 443
|
||||
@ -3133,7 +3133,7 @@ class SqlalchemyStorageTest(TestCase):
|
||||
|
||||
zone_master = self.storage.create_zone_master(
|
||||
self.admin_context, zone['id'],
|
||||
objects.ZoneMaster(host='127.0.0.1', port='80')
|
||||
objects.ZoneMaster(host='192.0.2.1', port='80')
|
||||
)
|
||||
|
||||
self.storage.delete_zone_master(
|
||||
|
@ -37,7 +37,7 @@ class WorkerNotifyTest(TestCase):
|
||||
super(WorkerNotifyTest, self).setUp()
|
||||
self.nameserver = objects.PoolNameserver.from_dict({
|
||||
'id': 'f278782a-07dc-4502-9177-b5d85c5f7c7e',
|
||||
'host': '127.0.0.1',
|
||||
'host': '192.0.2.1',
|
||||
'port': 65255
|
||||
})
|
||||
self.mock_tg = mock.Mock()
|
||||
|
@ -29,7 +29,7 @@ class TestApiVersion(oslotest.base.BaseTestCase):
|
||||
self.useFixture(cfg_fixture.Config(CONF))
|
||||
|
||||
def test_add_a_version(self):
|
||||
api_url = 'http://localhost/v2'
|
||||
api_url = 'http://203.0.113.1/v2'
|
||||
results = []
|
||||
|
||||
versions._add_a_version(
|
||||
@ -45,7 +45,7 @@ class TestApiVersion(oslotest.base.BaseTestCase):
|
||||
def test_get_versions(self):
|
||||
CONF.set_override('enable_host_header', False, 'service:api')
|
||||
CONF.set_override(
|
||||
'api_base_uri', 'http://127.0.0.2:9001/', 'service:api'
|
||||
'api_base_uri', 'http://203.0.113.1:9001/', 'service:api'
|
||||
)
|
||||
|
||||
self.app = versions.factory({})
|
||||
@ -57,7 +57,7 @@ class TestApiVersion(oslotest.base.BaseTestCase):
|
||||
|
||||
self.assertEqual(3, len(response.json['versions']))
|
||||
self.assertEqual(
|
||||
'http://127.0.0.2:9001/v2',
|
||||
'http://203.0.113.1:9001/v2',
|
||||
response.json['versions'][0]['links'][0]['href']
|
||||
)
|
||||
|
||||
|
@ -30,7 +30,7 @@ class InfobloxConnectorTestCase(oslotest.base.BaseTestCase):
|
||||
def setUp(self):
|
||||
super(InfobloxConnectorTestCase, self).setUp()
|
||||
self.options = {
|
||||
'wapi_url': 'https://localhost/wapi/v2.0/',
|
||||
'wapi_url': 'https://203.0.113.1/wapi/v2.0/',
|
||||
'username': 'username',
|
||||
'password': 'password',
|
||||
'ns_group': 'ns_group',
|
||||
@ -40,7 +40,7 @@ class InfobloxConnectorTestCase(oslotest.base.BaseTestCase):
|
||||
|
||||
def test_infoblox_constructor(self):
|
||||
options = {
|
||||
'wapi_url': 'https://localhost/wapi/v2.0/',
|
||||
'wapi_url': 'https://203.0.113.1/wapi/v2.0/',
|
||||
'username': 'username',
|
||||
'password': 'password',
|
||||
'ns_group': 'ns_group',
|
||||
@ -53,23 +53,23 @@ class InfobloxConnectorTestCase(oslotest.base.BaseTestCase):
|
||||
|
||||
def test_construct_url(self):
|
||||
self.assertEqual(
|
||||
'https://localhost/wapi/v2.0/test',
|
||||
'https://203.0.113.1/wapi/v2.0/test',
|
||||
self.infoblox._construct_url('test')
|
||||
)
|
||||
self.assertEqual(
|
||||
'https://localhost/wapi/v2.0/test?*foo=bar&foo=0&bar=1',
|
||||
'https://203.0.113.1/wapi/v2.0/test?*foo=bar&foo=0&bar=1',
|
||||
self.infoblox._construct_url(
|
||||
'test', {'foo': 0, 'bar': 1}, {'foo': {'value': 'bar'}}
|
||||
)
|
||||
)
|
||||
self.assertEqual(
|
||||
'https://localhost/wapi/v2.0/test?*foo=bar&foo=0',
|
||||
'https://203.0.113.1/wapi/v2.0/test?*foo=bar&foo=0',
|
||||
self.infoblox._construct_url(
|
||||
'test', {'foo': 0}, {'foo': {'value': 'bar'}}
|
||||
)
|
||||
)
|
||||
self.assertEqual(
|
||||
'https://localhost/wapi/v2.0/test?foo=0',
|
||||
'https://203.0.113.1/wapi/v2.0/test?foo=0',
|
||||
self.infoblox._construct_url(
|
||||
'test', {'foo': 0}
|
||||
)
|
||||
@ -98,7 +98,7 @@ class InfobloxConnectorTestCase(oslotest.base.BaseTestCase):
|
||||
class InfobloxBackendTestCase(oslotest.base.BaseTestCase):
|
||||
def setUp(self):
|
||||
super(InfobloxBackendTestCase, self).setUp()
|
||||
self.base_address = 'https://localhost/wapi'
|
||||
self.base_address = 'https://203.0.113.1/wapi'
|
||||
|
||||
self.context = mock.Mock()
|
||||
self.admin_context = mock.Mock()
|
||||
@ -118,7 +118,7 @@ class InfobloxBackendTestCase(oslotest.base.BaseTestCase):
|
||||
{'host': '1.1.1.1', 'port': 53},
|
||||
],
|
||||
'options': [
|
||||
{'key': 'wapi_url', 'value': 'https://localhost/wapi/v2.0/'},
|
||||
{'key': 'wapi_url', 'value': 'https://203.0.113.1/wapi/v2.0/'},
|
||||
{'key': 'username', 'value': 'test'},
|
||||
{'key': 'password', 'value': 'test'},
|
||||
{'key': 'ns_group', 'value': 'test'},
|
||||
|
@ -33,7 +33,7 @@ class PDNS4BackendTestCase(oslotest.base.BaseTestCase):
|
||||
context.DesignateContext, 'get_admin_context',
|
||||
return_value=self.admin_context).start()
|
||||
|
||||
self.base_address = 'http://localhost:8081/api/v1/servers'
|
||||
self.base_address = 'http://203.0.113.1:8081/api/v1/servers'
|
||||
self.zone = objects.Zone(
|
||||
id='e2bed4dc-9d01-11e4-89d3-123b93f75cba',
|
||||
name='example.com.',
|
||||
@ -47,7 +47,7 @@ class PDNS4BackendTestCase(oslotest.base.BaseTestCase):
|
||||
{'host': '192.0.2.2', 'port': 35},
|
||||
],
|
||||
'options': [
|
||||
{'key': 'api_endpoint', 'value': 'http://localhost:8081'},
|
||||
{'key': 'api_endpoint', 'value': 'http://203.0.113.1:8081'},
|
||||
{'key': 'api_token', 'value': 'api_key'},
|
||||
{'key': 'api_ca_cert', 'value': ''}
|
||||
],
|
||||
|
@ -143,14 +143,14 @@ class MdnsHandleTest(oslotest.base.BaseTestCase):
|
||||
request = dns.message.make_query(
|
||||
'www.example.org.', dns.rdatatype.SOA
|
||||
)
|
||||
request.environ = dict(addr=['127.0.0.1', 53], context=self.context)
|
||||
request.environ = dict(addr=['203.0.113.1', 53], context=self.context)
|
||||
|
||||
response = self.handler._handle_notify(request)
|
||||
|
||||
self.assertEqual(dns.rcode.REFUSED, tuple(response)[0].rcode())
|
||||
|
||||
self.assertIn(
|
||||
'NOTIFY for None from non-master server 127.0.0.1, refusing.',
|
||||
'NOTIFY for None from non-master server 203.0.113.1, refusing.',
|
||||
self.stdlog.logger.output
|
||||
)
|
||||
|
||||
|
@ -188,10 +188,10 @@ class TestDNSMessages(oslotest.base.BaseTestCase):
|
||||
|
||||
@mock.patch.object(dnsutils, 'send_dns_message')
|
||||
def test_notify(self, mock_send_dns_message):
|
||||
dnsutils.notify('notify.test.', 'localhost', port=54)
|
||||
dnsutils.notify('notify.test.', '203.0.113.1', port=54)
|
||||
|
||||
mock_send_dns_message.assert_called_with(
|
||||
mock.ANY, 'localhost', port=54, timeout=10
|
||||
mock.ANY, '203.0.113.1', port=54, timeout=10
|
||||
)
|
||||
|
||||
query = mock_send_dns_message.call_args[0][0]
|
||||
@ -209,10 +209,10 @@ class TestDNSMessages(oslotest.base.BaseTestCase):
|
||||
|
||||
@mock.patch.object(dnsutils, 'send_dns_message')
|
||||
def test_soa(self, mock_send_dns_message):
|
||||
dnsutils.soa_query('soa.test.', 'localhost', port=54)
|
||||
dnsutils.soa_query('soa.test.', '203.0.113.1', port=54)
|
||||
|
||||
mock_send_dns_message.assert_called_with(
|
||||
mock.ANY, 'localhost', port=54, timeout=10
|
||||
mock.ANY, '203.0.113.1', port=54, timeout=10
|
||||
)
|
||||
|
||||
query = mock_send_dns_message.call_args[0][0]
|
||||
@ -239,7 +239,7 @@ class TestDNSMessages(oslotest.base.BaseTestCase):
|
||||
mock_send_dns_message.return_value = mock_result
|
||||
|
||||
self.assertEqual(
|
||||
5, dnsutils.get_serial('serial.test.', 'localhost', port=54)
|
||||
5, dnsutils.get_serial('serial.test.', '203.0.113.1', port=54)
|
||||
)
|
||||
|
||||
query = mock_send_dns_message.call_args[0][0]
|
||||
@ -262,7 +262,7 @@ class TestDNSMessages(oslotest.base.BaseTestCase):
|
||||
mock_send_dns_message.return_value = mock_result
|
||||
|
||||
self.assertFalse(
|
||||
dnsutils.get_serial('serial.test.', 'localhost', port=54)
|
||||
dnsutils.get_serial('serial.test.', '203.0.113.1', port=54)
|
||||
)
|
||||
|
||||
@mock.patch.object(dnsutils, 'send_dns_message')
|
||||
@ -275,5 +275,5 @@ class TestDNSMessages(oslotest.base.BaseTestCase):
|
||||
mock_send_dns_message.return_value = mock_result
|
||||
|
||||
self.assertFalse(
|
||||
dnsutils.get_serial('serial.test.', 'localhost', port=54)
|
||||
dnsutils.get_serial('serial.test.', '203.0.113.1', port=54)
|
||||
)
|
||||
|
@ -35,7 +35,7 @@ class HeartbeatEmitterTest(oslotest.base.BaseTestCase):
|
||||
|
||||
CONF.set_override('emitter_type', 'noop', 'heartbeat_emitter')
|
||||
CONF.set_override('heartbeat_interval', 0.1, 'heartbeat_emitter')
|
||||
CONF.set_override('host', 'localhost')
|
||||
CONF.set_override('host', '203.0.113.1')
|
||||
|
||||
@mock.patch.object(loopingcall, 'FixedIntervalLoopingCall')
|
||||
def test_start(self, mock_looping):
|
||||
@ -75,7 +75,7 @@ class HeartbeatEmitterTest(oslotest.base.BaseTestCase):
|
||||
noop_emitter.stop()
|
||||
|
||||
self.assertIn(
|
||||
"<ServiceStatus service_name:'svc' hostname:'localhost' "
|
||||
"<ServiceStatus service_name:'svc' hostname:'203.0.113.1' "
|
||||
"status:'UP'>",
|
||||
self.stdlog.logger.output
|
||||
)
|
||||
|
@ -205,7 +205,7 @@ class TestDNSService(oslotest.base.BaseTestCase):
|
||||
self.service._running.is_set.side_effect = [True, True, False]
|
||||
|
||||
mock_client = mock.Mock()
|
||||
addr = ('192.0.2.1', 5353, '127.0.0.1', 5353)
|
||||
addr = ('192.0.2.1', 5353, '203.0.113.2', 5353)
|
||||
|
||||
mock_sock_tcp = mock.Mock()
|
||||
mock_sock_tcp.accept.return_value = (mock_client, addr)
|
||||
|
@ -35,7 +35,7 @@ class TestDuplicateServiceStatus(tests.TestCase):
|
||||
def test_success(self):
|
||||
fake_record = {'id': '1',
|
||||
'service_name': 'worker',
|
||||
'hostname': 'localhost',
|
||||
'hostname': '203.0.113.1',
|
||||
'status': 'UP',
|
||||
'stats': '',
|
||||
'capabilities': '',
|
||||
|
@ -362,16 +362,16 @@ class TestUtils(oslotest.base.BaseTestCase):
|
||||
mock_sock = mock.MagicMock()
|
||||
mock_sock_impl.return_value = mock_sock
|
||||
|
||||
utils.bind_tcp('127.0.0.1', 53, 100, 1)
|
||||
utils.bind_tcp('203.0.113.1', 53, 100, 1)
|
||||
|
||||
mock_sock.settimeout.assert_called_once_with(1)
|
||||
|
||||
mock_sock.bind.assert_called_once_with(('127.0.0.1', 53))
|
||||
mock_sock.bind.assert_called_once_with(('203.0.113.1', 53))
|
||||
|
||||
mock_sock.listen.assert_called_once_with(100)
|
||||
|
||||
self.assertIn(
|
||||
'Opening TCP Listening Socket on 127.0.0.1:53',
|
||||
'Opening TCP Listening Socket on 203.0.113.1:53',
|
||||
self.stdlog.logger.output
|
||||
)
|
||||
|
||||
@ -381,9 +381,9 @@ class TestUtils(oslotest.base.BaseTestCase):
|
||||
mock_sock = mock.MagicMock()
|
||||
mock_sock_impl.return_value = mock_sock
|
||||
|
||||
mock_sock.getsockname.return_value = ('127.0.0.1', random_port)
|
||||
mock_sock.getsockname.return_value = ('203.0.113.1', random_port)
|
||||
|
||||
utils.bind_tcp('127.0.0.1', 0, 100, 1)
|
||||
utils.bind_tcp('203.0.113.1', 0, 100, 1)
|
||||
|
||||
self.assertIn(
|
||||
'Listening on TCP port %(port)d' % {'port': random_port},
|
||||
@ -396,7 +396,7 @@ class TestUtils(oslotest.base.BaseTestCase):
|
||||
mock_sock_impl.return_value = mock_sock
|
||||
mock_sock.setsockopt.side_effect = [None, None, AttributeError, None]
|
||||
|
||||
utils.bind_tcp('127.0.0.1', 53, 100, 1)
|
||||
utils.bind_tcp('203.0.113.1', 53, 100, 1)
|
||||
|
||||
self.assertIn(
|
||||
'SO_REUSEPORT not available, ignoring.',
|
||||
@ -408,14 +408,14 @@ class TestUtils(oslotest.base.BaseTestCase):
|
||||
mock_sock = mock.MagicMock()
|
||||
mock_sock_impl.return_value = mock_sock
|
||||
|
||||
utils.bind_udp('127.0.0.1', 53)
|
||||
utils.bind_udp('203.0.113.1', 53)
|
||||
|
||||
mock_sock.settimeout.assert_called_once_with(1)
|
||||
|
||||
mock_sock.bind.assert_called_once_with(('127.0.0.1', 53))
|
||||
mock_sock.bind.assert_called_once_with(('203.0.113.1', 53))
|
||||
|
||||
self.assertIn(
|
||||
'Opening UDP Listening Socket on 127.0.0.1:53',
|
||||
'Opening UDP Listening Socket on 203.0.113.1:53',
|
||||
self.stdlog.logger.output
|
||||
)
|
||||
|
||||
@ -425,9 +425,9 @@ class TestUtils(oslotest.base.BaseTestCase):
|
||||
mock_sock = mock.MagicMock()
|
||||
mock_sock_impl.return_value = mock_sock
|
||||
|
||||
mock_sock.getsockname.return_value = ('127.0.0.1', random_port)
|
||||
mock_sock.getsockname.return_value = ('203.0.113.1', random_port)
|
||||
|
||||
utils.bind_udp('127.0.0.1', 0)
|
||||
utils.bind_udp('203.0.113.1', 0)
|
||||
|
||||
self.assertIn(
|
||||
'Listening on UDP port %(port)d' % {'port': random_port},
|
||||
@ -440,7 +440,7 @@ class TestUtils(oslotest.base.BaseTestCase):
|
||||
mock_sock_impl.return_value = mock_sock
|
||||
mock_sock.setsockopt.side_effect = [None, AttributeError]
|
||||
|
||||
utils.bind_udp('127.0.0.1', 53)
|
||||
utils.bind_udp('203.0.113.1', 53)
|
||||
|
||||
self.assertIn(
|
||||
'SO_REUSEPORT not available, ignoring.',
|
||||
|
@ -36,7 +36,7 @@ class WorkerNotifyTest(oslotest.base.BaseTestCase):
|
||||
self.useFixture(cfg_fixture.Config(CONF))
|
||||
self.zone = RoObject(name='zn', serial=314)
|
||||
self.notify = worker_zone.GetZoneSerial(
|
||||
mock.Mock(), mock.Mock(), self.zone, 'localhost', 1234
|
||||
mock.Mock(), mock.Mock(), self.zone, '203.0.113.1', 1234
|
||||
)
|
||||
|
||||
@mock.patch('time.sleep', mock.Mock())
|
||||
@ -53,7 +53,7 @@ class WorkerNotifyTest(oslotest.base.BaseTestCase):
|
||||
)
|
||||
zone = RoObject(name='zn', serial=314)
|
||||
notify = worker_zone.GetZoneSerial(mock.Mock(), mock.Mock(),
|
||||
zone, 'localhost',
|
||||
zone, '203.0.113.1',
|
||||
1234)
|
||||
notify._make_and_send_soa_message = mock.Mock(
|
||||
return_value=response
|
||||
@ -73,7 +73,7 @@ class WorkerNotifyTest(oslotest.base.BaseTestCase):
|
||||
)
|
||||
zone = RoObject(name='zn', serial=0, action='DELETE')
|
||||
notify = worker_zone.GetZoneSerial(mock.Mock(), mock.Mock(),
|
||||
zone, 'localhost',
|
||||
zone, '203.0.113.1',
|
||||
1234)
|
||||
notify._make_and_send_soa_message = mock.Mock(
|
||||
return_value=response
|
||||
@ -96,7 +96,7 @@ class WorkerNotifyTest(oslotest.base.BaseTestCase):
|
||||
ednsflags=dns.rcode.NOERROR,
|
||||
)
|
||||
notify = worker_zone.GetZoneSerial(mock.Mock(), mock.Mock(),
|
||||
zone, 'localhost',
|
||||
zone, '203.0.113.1',
|
||||
1234)
|
||||
notify._make_and_send_soa_message = mock.Mock(
|
||||
return_value=response
|
||||
@ -117,7 +117,7 @@ class WorkerNotifyTest(oslotest.base.BaseTestCase):
|
||||
mock_send_dns_message.return_value = response
|
||||
|
||||
notify = worker_zone.GetZoneSerial(mock.Mock(), mock.Mock(),
|
||||
self.zone, 'localhost',
|
||||
self.zone, '203.0.113.1',
|
||||
1234)
|
||||
|
||||
self.assertEqual(('ERROR', None), notify())
|
||||
@ -135,7 +135,7 @@ class WorkerNotifyTest(oslotest.base.BaseTestCase):
|
||||
mock_send_dns_message.return_value = response
|
||||
|
||||
notify = worker_zone.GetZoneSerial(mock.Mock(), mock.Mock(),
|
||||
self.zone, 'localhost',
|
||||
self.zone, '203.0.113.1',
|
||||
1234)
|
||||
|
||||
self.assertEqual(('ERROR', None), notify())
|
||||
|
@ -316,13 +316,13 @@ class TestService(oslotest.base.BaseTestCase):
|
||||
zone = mock.Mock()
|
||||
|
||||
self.service.get_serial_number(
|
||||
self.context, zone, 'localhost', 53
|
||||
self.context, zone, '203.0.113.1', 53
|
||||
)
|
||||
|
||||
mock_get_serial_number.assert_called_with(
|
||||
self.service.executor,
|
||||
self.context,
|
||||
zone,
|
||||
'localhost',
|
||||
'203.0.113.1',
|
||||
53
|
||||
)
|
||||
|
@ -44,7 +44,7 @@ class TestXfr(oslotest.base.BaseTestCase):
|
||||
name='example.com.',
|
||||
serial=1,
|
||||
masters=objects.ZoneMasterList.from_list(
|
||||
[{'host': '127.0.0.1', 'port': 53}, ]
|
||||
[{'host': '203.0.113.1', 'port': 53}, ]
|
||||
),
|
||||
type=constants.ZONE_SECONDARY,
|
||||
)
|
||||
@ -73,7 +73,7 @@ class TestXfr(oslotest.base.BaseTestCase):
|
||||
name='example.com.',
|
||||
serial=1,
|
||||
masters=objects.ZoneMasterList.from_list(
|
||||
[{'host': '127.0.0.1', 'port': 53}, ]
|
||||
[{'host': '203.0.113.1', 'port': 53}, ]
|
||||
),
|
||||
type=constants.ZONE_SECONDARY,
|
||||
recordsets=objects.RecordSetList(objects=[]),
|
||||
@ -103,7 +103,7 @@ class TestXfr(oslotest.base.BaseTestCase):
|
||||
|
||||
self.xfr = worker_zone.ZoneXfr(
|
||||
mock.Mock(), self.context, zone,
|
||||
servers=[{'host': '127.0.0.1', 'port': 53}, ]
|
||||
servers=[{'host': '203.0.113.1', 'port': 53}, ]
|
||||
)
|
||||
self.xfr._central_api = mock.Mock()
|
||||
|
||||
@ -122,7 +122,7 @@ class TestXfr(oslotest.base.BaseTestCase):
|
||||
name='example.com.',
|
||||
serial=1,
|
||||
masters=objects.ZoneMasterList.from_list(
|
||||
[{'host': '127.0.0.1', 'port': 53}, ]
|
||||
[{'host': '203.0.113.1', 'port': 53}, ]
|
||||
),
|
||||
type=constants.ZONE_SECONDARY,
|
||||
)
|
||||
@ -144,7 +144,7 @@ class TestXfr(oslotest.base.BaseTestCase):
|
||||
name='example.com.',
|
||||
serial=1,
|
||||
masters=objects.ZoneMasterList.from_list(
|
||||
[{'host': '127.0.0.1', 'port': 53}, ]
|
||||
[{'host': '203.0.113.1', 'port': 53}, ]
|
||||
),
|
||||
type=constants.ZONE_PRIMARY,
|
||||
)
|
||||
|
@ -158,7 +158,7 @@ class TestZoneActionOnTarget(oslotest.base.BaseTestCase):
|
||||
'id': '4588652b-50e7-46b9-b688-a9bad40a873e',
|
||||
'type': 'fake',
|
||||
'options': [
|
||||
{'key': 'host', 'value': '127.0.0.1'},
|
||||
{'key': 'host', 'value': '203.0.113.1'},
|
||||
{'key': 'port', 'value': 53},
|
||||
],
|
||||
'backend': self.backend,
|
||||
@ -183,7 +183,7 @@ class TestZoneActionOnTarget(oslotest.base.BaseTestCase):
|
||||
|
||||
mock_notify.assert_called_once_with(
|
||||
self.zone.name,
|
||||
'127.0.0.1',
|
||||
'203.0.113.1',
|
||||
port=53
|
||||
)
|
||||
|
||||
@ -202,7 +202,7 @@ class TestZoneActionOnTarget(oslotest.base.BaseTestCase):
|
||||
|
||||
mock_notify.assert_called_once_with(
|
||||
self.zone.name,
|
||||
'127.0.0.1',
|
||||
'203.0.113.1',
|
||||
port=53
|
||||
)
|
||||
|
||||
@ -248,7 +248,7 @@ class TestSendNotify(oslotest.base.BaseTestCase):
|
||||
'id': '4588652b-50e7-46b9-b688-a9bad40a873e',
|
||||
'type': 'fake',
|
||||
'options': [
|
||||
{'key': 'host', 'value': '127.0.0.1'},
|
||||
{'key': 'host', 'value': '203.0.113.1'},
|
||||
{'key': 'port', 'value': 53},
|
||||
],
|
||||
})
|
||||
@ -268,7 +268,7 @@ class TestSendNotify(oslotest.base.BaseTestCase):
|
||||
|
||||
mock_notify.assert_called_once_with(
|
||||
self.zone.name,
|
||||
'127.0.0.1',
|
||||
'203.0.113.1',
|
||||
port=53
|
||||
)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user