Patch DNS lookups in Unit tests
Currently the unit testing suite has a minimal set of IPs hard-coded (in the subnet 10.0.0.0/8). The failing unit tests call functions that will perform DNS reverse lookups on the hard-coded IPs. In the event that a DNS server is unavailable, or misconfigured, the DNS lookups will result in a Python Exception being thrown, causing the unit tests to fail. This solution patches DNS lookups to return None result. Also add OS_* to tox passenv to resolve the http proxy issue in retrieving the cirros image. Change-Id: I7a519fbe7fba5f3aefd22c57b8d44e3b39c99582 Closes-Bug: #1841806
This commit is contained in:
parent
9802c2ff1b
commit
a6461cbb9f
2
tox.ini
2
tox.ini
|
@ -14,7 +14,7 @@ install_command =
|
|||
pip install {opts} {packages}
|
||||
commands = stestr run {posargs}
|
||||
whitelist_externals = juju
|
||||
passenv = HOME TERM AMULET_* CS_API_*
|
||||
passenv = HOME TERM AMULET_* CS_API_* OS_*
|
||||
|
||||
[testenv:py35]
|
||||
basepython = python3.5
|
||||
|
|
|
@ -30,6 +30,7 @@ TO_PATCH = [
|
|||
'charmhelpers.contrib.network.ip.get_iface_for_address',
|
||||
'charmhelpers.contrib.network.ip.get_netmask_for_address',
|
||||
'charmhelpers.contrib.network.ip.get_relation_ip',
|
||||
'charmhelpers.contrib.network.ip.ns_query',
|
||||
'charmhelpers.contrib.openstack.ha.utils.generate_ha_relation_data',
|
||||
'charmhelpers.contrib.openstack.ha.utils.update_dns_ha_resource_params',
|
||||
'charmhelpers.contrib.openstack.neutron.network_manager',
|
||||
|
@ -98,6 +99,7 @@ class NovaCCHooksTests(CharmTestCase):
|
|||
self.config.side_effect = self.test_config.get
|
||||
self.relation_get.side_effect = self.test_relation.get
|
||||
self.charm_dir.return_value = '/var/lib/juju/charms/nova/charm'
|
||||
self.ns_query.return_value = None
|
||||
self.is_unit_paused_set.return_value = False
|
||||
# disable hardening for unit tests
|
||||
harden._DISABLE_HARDENING_FOR_UNIT_TEST = True
|
||||
|
|
Loading…
Reference in New Issue