mirror of
https://github.com/systemd/systemd
synced 2024-09-06 16:56:43 +00:00
test-network: add test for global UseDomains= setting
This commit is contained in:
parent
418f2dc755
commit
d51377ac42
|
@ -6909,9 +6909,11 @@ class NetworkdDHCPClientTests(unittest.TestCase, Utilities):
|
|||
check(self, False, False)
|
||||
|
||||
def test_dhcp_client_default_use_domains(self):
|
||||
def check(self, ipv4, ipv6):
|
||||
def check(self, common, ipv4, ipv6):
|
||||
mkdir_p(networkd_conf_dropin_dir)
|
||||
with open(os.path.join(networkd_conf_dropin_dir, 'default_use_domains.conf'), mode='w', encoding='utf-8') as f:
|
||||
f.write('[Network]\nUseDomains=')
|
||||
f.write('yes\n' if common else 'no\n')
|
||||
f.write('[DHCPv4]\nUseDomains=')
|
||||
f.write('yes\n' if ipv4 else 'no\n')
|
||||
f.write('[DHCPv6]\nUseDomains=')
|
||||
|
@ -6932,7 +6934,7 @@ class NetworkdDHCPClientTests(unittest.TestCase, Utilities):
|
|||
|
||||
for _ in range(20):
|
||||
output = resolvectl('domain', 'veth99')
|
||||
if ipv4 or ipv6:
|
||||
if common or ipv4 or ipv6:
|
||||
if 'example.com' in output:
|
||||
break
|
||||
else:
|
||||
|
@ -6941,16 +6943,18 @@ class NetworkdDHCPClientTests(unittest.TestCase, Utilities):
|
|||
time.sleep(0.5)
|
||||
else:
|
||||
print(output)
|
||||
print(read_link_state_file('veth99'))
|
||||
self.fail('unexpected domain setting in resolved...')
|
||||
|
||||
stop_dnsmasq()
|
||||
remove_networkd_conf_dropin('default_use_domains.conf')
|
||||
|
||||
copy_network_unit('25-veth.netdev', '25-dhcp-server-veth-peer.network', '25-dhcp-client.network', copy_dropins=False)
|
||||
check(self, True, True)
|
||||
check(self, True, False)
|
||||
check(self, False, True)
|
||||
check(self, False, False)
|
||||
check(self, True, False, False)
|
||||
check(self, False, True, True)
|
||||
check(self, False, True, False)
|
||||
check(self, False, False, True)
|
||||
check(self, False, False, False)
|
||||
|
||||
def test_dhcp_client_use_captive_portal(self):
|
||||
def check(self, ipv4, ipv6):
|
||||
|
|
Loading…
Reference in a new issue