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
diff --git a/tempest/scenario/test_network_basic_ops.py b/tempest/scenario/test_network_basic_ops.py
index 9590eb4..add5c32 100644
--- a/tempest/scenario/test_network_basic_ops.py
+++ b/tempest/scenario/test_network_basic_ops.py
@@ -624,6 +624,13 @@
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),