Fix unstability in test_subnet_details

when the image has some dns preconfigured in /etc/resolv.conf,
for example:

resolv.conf
nameserver 192.168.122.1

the test failed due to:
testtools.matchers._impl.MismatchError:
{'1.2.3.4'} != {'1.2.3.4', '192.168.122.1'}: Looking for servers: ['1.2.3.4'].
Retrieved DNS nameservers: ['192.168.122.1', '1.2.3.4'] From host: 10.0.0.234

DHCP renewal is forced in the server that will cleanup the file
/etc/resolv.conf from any other preconfigured DNS entry. When
the DHCP server pushes the new configuration, the Neutron network
DNS entries are applied

Closes-Bug: #1914229
Change-Id: I9bd8b47642891a1fe42c48a0b9fe50cf9bc4e03b
This commit is contained in:
ccamposr 2021-03-10 13:31:50 +01:00 committed by Candido Campos Rivas
parent 771fee4334
commit 3893f9db48
1 changed files with 7 additions and 0 deletions

View File

@ -624,6 +624,13 @@ class TestNetworkBasicOps(manager.NetworkScenarioTest):
ssh_client = self.get_remote_client(
ip_address, private_key=private_key, server=server)
# NOTE: Server needs to renew its dhcp lease in order to get new
# definitions from subnet
# NOTE(amuller): we are renewing the lease as part of the retry
# because Neutron updates dnsmasq asynchronously after the
# subnet-update API call returns.
ssh_client.renew_lease(fixed_ip=floating_ip['fixed_ip_address'],
dhcp_client=CONF.scenario.dhcp_client)
dns_servers = [initial_dns_server]
servers = ssh_client.get_dns_servers()
self.assertEqual(set(dns_servers), set(servers),