Merge "Make regex in extra dhcp opts test less strict"

This commit is contained in:
Zuul 2024-06-30 14:48:26 +00:00 committed by Gerrit Code Review
commit fd8e967b1e

View File

@ -226,7 +226,7 @@ class ExtraDhcpOptionsTest(base.BaseTempestTestCase):
# ipv4.domain is not expected # ipv4.domain is not expected
vm_resolv_conf = vm_ssh_client.exec_command( vm_resolv_conf = vm_ssh_client.exec_command(
"sudo dhclient && cat /etc/resolv.conf") "sudo dhclient && cat /etc/resolv.conf")
self.assertIsNone(re.search(r'^search\s+{}$'.format(domain_value), self.assertIsNone(re.search(r'^search\s+{}\s+'.format(domain_value),
vm_resolv_conf, vm_resolv_conf,
re.MULTILINE)) re.MULTILINE))
@ -241,7 +241,10 @@ class ExtraDhcpOptionsTest(base.BaseTempestTestCase):
# ipv4.domain is expected # ipv4.domain is expected
vm_resolv_conf = vm_ssh_client.exec_command( vm_resolv_conf = vm_ssh_client.exec_command(
"sudo dhclient && cat /etc/resolv.conf") "sudo dhclient && cat /etc/resolv.conf")
self.assertIsNotNone(re.search(r'^search\s+{}$'.format(domain_value), # (rsafrono) this regex will work reliably even in case dhcp_domain in
# nova.conf is defined, i.e. not an empty value. Helps to stabilize
# the test on podified environments.
self.assertIsNotNone(re.search(r'^search\s+{}\s+'.format(domain_value),
vm_resolv_conf, vm_resolv_conf,
re.MULTILINE)) re.MULTILINE))