Merge lp://qastaging/~hggdh2/ubuntu-server-iso-testing/fix-dns-test into lp://qastaging/ubuntu-server-iso-testing

Proposed by C de-Avillez
Status: Needs review
Proposed branch: lp://qastaging/~hggdh2/ubuntu-server-iso-testing/fix-dns-test
Merge into: lp://qastaging/ubuntu-server-iso-testing
Diff against target: 71 lines (+22/-9)
1 file modified
templates/test_cases/dns-server/test (+22/-9)
To merge this branch: bzr merge lp://qastaging/~hggdh2/ubuntu-server-iso-testing/fix-dns-test
Reviewer Review Type Date Requested Status
Jean-Baptiste Lallement Needs Fixing
Review via email: mp+128983@code.qastaging.launchpad.net

Description of the change

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

To post a comment you must log in.
Revision history for this message
Jean-Baptiste Lallement (jibel) wrote :

* The right place for the dns configuration setup would be in a setUp method of the class DnsServerTest
* The following code can be more concise with readlines() instead of read() + splitlines()
content = resolver.read()
      for line in content.splitlines():
* You fixed indentation but introduced broken indentation lines 92 to 95, it should be 8, 12 and 16 spaces instead of 6,8 and 10 respectively
* ns_address = line.split(' ')[1] will fail if there is more than 1 space between the name of the option and the IP, split() without explicit separator, consecutive spaces will be considered as 1 separator.
* If there is more than 1 nameserver in resolv.conf the last entry will be used. Is it ok since the resolver uses them in order ?
* If there is no nameserver entry, /etc/bind/named.conf.options will be rewritten with a 'None' in it which will fail. The setup should be aborted in this case because the test cannot pass without it.
* Catch the returncode of subprocess.call(['sudo', 'service', 'bind9', 'restart']) or use check_call and catch the exception, and cancel if it failed. If the DNS doesn't start properly the test will fail.
* The test changes the configuration of the DNS server of the host it is running on and it should be documented.

review: Needs Fixing

Unmerged revisions

262. By C de-Avillez

templates/test_cases/dns-server:
  * correct mix of \t and spaces
  * adjust for actually using named on the localhost

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches