ubuntu-server-iso-testing-dev team mailing list archive
-
ubuntu-server-iso-testing-dev team
-
Mailing list archive
-
Message #00206
[Merge] lp:~hggdh2/ubuntu-server-iso-testing/fix-dns-test into lp:ubuntu-server-iso-testing
C de-Avillez has proposed merging lp:~hggdh2/ubuntu-server-iso-testing/fix-dns-test into lp:ubuntu-server-iso-testing.
Requested reviews:
Ubuntu Server Iso Testing Developers (ubuntu-server-iso-testing-dev)
For more details, see:
https://code.launchpad.net/~hggdh2/ubuntu-server-iso-testing/fix-dns-test/+merge/128983
1. there were some tabs mixed in the test code, I replaced them with spaces
2. adjust to actually run the DNS tests (find the current name server from /etc/resolv.conf, and add it in /etc/bind9/named.conf.options
--
https://code.launchpad.net/~hggdh2/ubuntu-server-iso-testing/fix-dns-test/+merge/128983
Your team Ubuntu Server Iso Testing Developers is requested to review the proposed merge of lp:~hggdh2/ubuntu-server-iso-testing/fix-dns-test into lp:ubuntu-server-iso-testing.
=== modified file 'templates/test_cases/dns-server/test'
--- templates/test_cases/dns-server/test 2011-11-16 17:00:07 +0000
+++ templates/test_cases/dns-server/test 2012-10-10 15:56:25 +0000
@@ -41,7 +41,7 @@
logging.debug("Cmd: %s" % (cmd))
output = subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()[0]
logging.debug("Cmd output: %s" % (output))
- output2 = filter(lambda l: l.split()[6].split('/')[1] == 'named',
+ output2 = filter(lambda l: l.split()[6].split('/')[1] == 'named',
output.strip().split('\n')[2:])
self.assertEquals(len(output2), 5, output2)
@@ -52,8 +52,8 @@
stderr=subprocess.STDOUT)
output = proc.communicate()[0]
logging.debug("Cmd output: %s" % (output))
- ret = proc.returncode
- self.assertEquals(ret, 0)
+ ret = proc.returncode
+ self.assertEquals(ret, 0)
def testResolveUdp6(self):
cmd = ["host", "-6", "www.ubuntu.com", "ip6-localhost"]
@@ -62,8 +62,8 @@
stderr=subprocess.STDOUT)
output = proc.communicate()[0]
logging.debug("Cmd output: %s" % (output))
- ret = proc.returncode
- self.assertEquals(ret, 0)
+ ret = proc.returncode
+ self.assertEquals(ret, 0)
def testResolveTcp(self):
cmd = ["host", "-T", "www.ubuntu.com", "localhost"]
@@ -72,8 +72,8 @@
stderr=subprocess.STDOUT)
output = proc.communicate()[0]
logging.debug("Cmd output: %s" % (output))
- ret = proc.returncode
- self.assertEquals(ret, 0)
+ ret = proc.returncode
+ self.assertEquals(ret, 0)
def testResolveTcp6(self):
cmd = ["host", "-T", "-6", "www.ubuntu.com", "ip6-localhost"]
@@ -82,10 +82,23 @@
stderr=subprocess.STDOUT)
output = proc.communicate()[0]
logging.debug("Cmd output: %s" % (output))
- ret = proc.returncode
- self.assertEquals(ret, 0)
+ ret = proc.returncode
+ self.assertEquals(ret, 0)
if __name__ == '__main__':
+ # find out where we are resolving addresses
+ ns_address = None
+ with open('/etc/resolv.conf', 'r') as resolver:
+ content = resolver.read()
+ for line in content.splitlines():
+ if line.startswith('nameserver'):
+ ns_address = line.split(' ')[1]
+ # set resolv.conf to use our local nameserver (not really needed, the tests force the server to localhost
+ # subprocess.call(['sudo', 'sed', '-i', 's/^nameserver.*/nameserver 127.0.0.1/', '/etc/resolv.conf'])
+ # set named forwarders to our resolver in the original resolv.conf
+ forwarder = 's/^}/\tforwarders {%s;};}/' % ns_address
+ subprocess.call(['sudo', 'sed', '-i', forwarder, '/etc/bind/named.conf.options'])
# give the system some time to finish startup
time.sleep(5)
+ subprocess.call(['sudo', 'service', 'bind9', 'restart'])
unittest.main()
Follow ups