summaryrefslogtreecommitdiff
path: root/test/networkd-test.py
diff options
context:
space:
mode:
authorMartin Pitt <martin.pitt@ubuntu.com>2016-06-28 18:18:27 +0200
committerLennart Poettering <lennart@poettering.net>2016-06-28 18:18:27 +0200
commit94363cbbf38023bac4fc90595d2d839d25acfe38 (patch)
treeeacb4a1f01e1930f31b979f1335ff241244644d9 /test/networkd-test.py
parenta29337d18678c5ebc5c1fd17b7fa4016551c5646 (diff)
resolved: add test for route-only domain filtering (#3609)
With commit 6f7da49d00 route-only domains do not get put into resolv.conf's "search" list any more. Add a comment about the tri-state, to clarify its semantics and why we are passing a bool parameter into an int type. Also add a test case for it.
Diffstat (limited to 'test/networkd-test.py')
-rwxr-xr-xtest/networkd-test.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/test/networkd-test.py b/test/networkd-test.py
index 78da0a213a..8f5d43bc88 100755
--- a/test/networkd-test.py
+++ b/test/networkd-test.py
@@ -227,6 +227,37 @@ DHCP=%s
def test_hotplug_dhcp_ip6(self):
self.do_test(coldplug=False, ipv6=True)
+ def test_route_only_dns(self):
+ with open('/run/systemd/network/myvpn.netdev', 'w') as f:
+ f.write('''[NetDev]
+Name=dummy0
+Kind=dummy
+MACAddress=12:34:56:78:9a:bc''')
+ with open('/run/systemd/network/myvpn.network', 'w') as f:
+ f.write('''[Match]
+Name=dummy0
+[Network]
+Address=192.168.42.100
+DNS=192.168.42.1
+Domains= ~company''')
+ self.addCleanup(os.remove, '/run/systemd/network/myvpn.netdev')
+ self.addCleanup(os.remove, '/run/systemd/network/myvpn.network')
+
+ self.do_test(coldplug=True, ipv6=False,
+ extra_opts='IPv6AcceptRouterAdvertisements=False')
+
+ if os.path.islink('/etc/resolv.conf'):
+ with open('/etc/resolv.conf') as f:
+ contents = f.read()
+
+ # ~company is not a search domain, only a routing domain
+ self.assertNotRegex(contents, 'search.*company')
+
+ # our global server should appear, unless we already have three
+ # (different) servers
+ if contents.count('nameserver ') < 3:
+ self.assertIn('nameserver 192.168.5.1\n', contents)
+
@unittest.skipUnless(have_dnsmasq, 'dnsmasq not installed')
class DnsmasqClientTest(ClientTestBase, unittest.TestCase):