Merge lp:~lamont/maas/dns-failures-1.10 into lp:maas/1.10

Proposed by LaMont Jones
Status: Merged
Approved by: LaMont Jones
Approved revision: no longer in the source branch.
Merged at revision: 4583
Proposed branch: lp:~lamont/maas/dns-failures-1.10
Merge into: lp:maas/1.10
Diff against target: 121 lines (+18/-32)
4 files modified
src/maasserver/dns/tests/test_config.py (+2/-0)
src/provisioningserver/dns/tests/test_config.py (+2/-1)
src/provisioningserver/utils/fs.py (+7/-16)
src/provisioningserver/utils/tests/test_fs.py (+7/-15)
To merge this branch: bzr merge lp:~lamont/maas/dns-failures-1.10
Reviewer Review Type Date Requested Status
Lee Trager (community) Approve
Review via email: mp+287253@code.launchpad.net

Commit message

Backport fixes for DNS test failures from 2.0 (trunk). BIND 9.10 (now in xenial) does not reload zone files that are older than the time of the last reload of that file, so we need to keep time correctly on the zone files, and possibly let it creep into the future in order to make sure that the file gets reloaded when there is heavy churn.

Description of the change

Backport fixes for DNS test failures from 2.0 (trunk). BIND 9.10 (now in xenial) does not reload zone files that are older than the time of the last reload of that file, so we need to keep time correctly on the zone files, and possibly let it creep into the future in order to make sure that the file gets reloaded when there is heavy churn.

To post a comment you must log in.
Revision history for this message
Lee Trager (ltrager) wrote :

LGTM!

review: Approve
Revision history for this message
MAAS Lander (maas-lander) wrote :

There are additional revisions which have not been approved in review. Please seek review and approval of these new revisions.

Revision history for this message
MAAS Lander (maas-lander) wrote :
Download full text (1021.6 KiB)

The attempt to merge lp:~lamont/maas/dns-failures-1.10 into lp:maas/1.10 failed. Below is the output from the failed tests.

Hit:1 http://security.ubuntu.com/ubuntu xenial-security InRelease
Hit:2 http://prodstack-zone-1.clouds.archive.ubuntu.com/ubuntu xenial InRelease
Hit:3 http://prodstack-zone-1.clouds.archive.ubuntu.com/ubuntu xenial-updates InRelease
Hit:4 http://prodstack-zone-1.clouds.archive.ubuntu.com/ubuntu xenial-backports InRelease
Reading package lists...
sudo DEBIAN_FRONTEND=noninteractive apt-get -y \
    --no-install-recommends install apache2 authbind bind9 bind9utils build-essential bzr-builddeb chromium-browser chromium-chromedriver curl daemontools debhelper dh-apport dh-systemd distro-info dnsutils firefox freeipmi-tools git gjs ipython isc-dhcp-common libjs-angularjs libjs-jquery libjs-jquery-hotkeys libjs-yui3-full libjs-yui3-min libpq-dev make nodejs-legacy npm postgresql pxelinux python3-apt python3-bson python3-convoy python3-crochet python3-cssselect python3-curtin python3-dev python3-distro-info python3-django python3-django-nose python3-django-piston3 python3-djorm-ext-pgarray python3-docutils python3-formencode python3-hivex python3-httplib2 python3-jinja2 python3-jsonschema python3-lxml python3-mock python3-netaddr python3-netifaces python3-oauth python3-openssl python3-paramiko python3-petname python3-pexpect python3-psycopg2 python3-pyinotify python3-pyparsing python3-pyvmomi python3-seamicroclient python3-simplejson python3-simplestreams python3-sphinx python3-tempita python3-twisted python3-txtftp python3-tz python3-yaml python3-zope.interface python-bson python-crochet python-django python-django-piston python-djorm-ext-pgarray python-formencode python-lxml python-netaddr python-netifaces python-pocket-lint python-psycopg2 python-tempita python-twisted python-yaml socat syslinux-common tgt ubuntu-cloudimage-keyring wget xvfb
Reading package lists...
Building dependency tree...
Reading state information...
apache2 is already the newest version (2.4.18-1ubuntu1).
authbind is already the newest version (2.1.1+nmu1).
bind9 is already the newest version (1:9.10.3.dfsg.P2-4).
bind9utils is already the newest version (1:9.10.3.dfsg.P2-4).
build-essential is already the newest version (12.1ubuntu2).
curl is already the newest version (7.47.0-1ubuntu2).
debhelper is already the newest version (9.20160115ubuntu2).
dh-apport is already the newest version (2.20-0ubuntu3).
dh-systemd is already the newest version (1.28ubuntu2).
distro-info is already the newest version (0.14build1).
dnsutils is already the newest version (1:9.10.3.dfsg.P2-4).
firefox is already the newest version (44.0.2+build1-0ubuntu1).
freeipmi-tools is already the newest version (1.4.11-1ubuntu1).
git is already the newest version (1:2.7.0-1).
isc-dhcp-common is already the newest version (4.3.3-5ubuntu7).
libjs-angularjs is already the newest version (1.2.28-1ubuntu2).
libjs-jquery is already the newest version (1.11.3+dfsg-4).
libjs-jquery-hotkeys is already the newest version (0~20130707+git2d51e3a9+dfsg-2ubuntu1).
libjs-yui3-full is already the newest version (3.5.1-1ubuntu3).
libjs-yui3-min is already the newest version (3.5.1-1ubuntu3).
libpq...

Revision history for this message
MAAS Lander (maas-lander) wrote :
Download full text (1.0 MiB)

The attempt to merge lp:~lamont/maas/dns-failures-1.10 into lp:maas/1.10 failed. Below is the output from the failed tests.

Hit:1 http://security.ubuntu.com/ubuntu xenial-security InRelease
Get:2 http://prodstack-zone-1.clouds.archive.ubuntu.com/ubuntu xenial InRelease [95.8 kB]
Hit:3 http://prodstack-zone-1.clouds.archive.ubuntu.com/ubuntu xenial-updates InRelease
Hit:4 http://prodstack-zone-1.clouds.archive.ubuntu.com/ubuntu xenial-backports InRelease
Get:5 http://prodstack-zone-1.clouds.archive.ubuntu.com/ubuntu xenial/main Sources [1,109 kB]
Get:6 http://prodstack-zone-1.clouds.archive.ubuntu.com/ubuntu xenial/main amd64 Packages [1,443 kB]
Get:7 http://prodstack-zone-1.clouds.archive.ubuntu.com/ubuntu xenial/main Translation-en [842 kB]
Get:8 http://prodstack-zone-1.clouds.archive.ubuntu.com/ubuntu xenial/universe amd64 Packages [7,347 kB]
Fetched 10.8 MB in 2s (3,900 kB/s)
Reading package lists...
sudo DEBIAN_FRONTEND=noninteractive apt-get -y \
    --no-install-recommends install apache2 authbind bind9 bind9utils build-essential bzr-builddeb chromium-browser chromium-chromedriver curl daemontools debhelper dh-apport dh-systemd distro-info dnsutils firefox freeipmi-tools git gjs ipython isc-dhcp-common libjs-angularjs libjs-jquery libjs-jquery-hotkeys libjs-yui3-full libjs-yui3-min libpq-dev make nodejs-legacy npm postgresql pxelinux python3-apt python3-bson python3-convoy python3-crochet python3-cssselect python3-curtin python3-dev python3-distro-info python3-django python3-django-nose python3-django-piston3 python3-djorm-ext-pgarray python3-docutils python3-formencode python3-hivex python3-httplib2 python3-jinja2 python3-jsonschema python3-lxml python3-mock python3-netaddr python3-netifaces python3-oauth python3-openssl python3-paramiko python3-petname python3-pexpect python3-psycopg2 python3-pyinotify python3-pyparsing python3-pyvmomi python3-seamicroclient python3-simplejson python3-simplestreams python3-sphinx python3-tempita python3-twisted python3-txtftp python3-tz python3-yaml python3-zope.interface python-bson python-crochet python-django python-django-piston python-djorm-ext-pgarray python-formencode python-lxml python-netaddr python-netifaces python-pocket-lint python-psycopg2 python-tempita python-twisted python-yaml socat syslinux-common tgt ubuntu-cloudimage-keyring wget xvfb
Reading package lists...
Building dependency tree...
Reading state information...
apache2 is already the newest version (2.4.18-1ubuntu1).
authbind is already the newest version (2.1.1+nmu1).
bind9 is already the newest version (1:9.10.3.dfsg.P2-4).
bind9utils is already the newest version (1:9.10.3.dfsg.P2-4).
build-essential is already the newest version (12.1ubuntu2).
curl is already the newest version (7.47.0-1ubuntu2).
debhelper is already the newest version (9.20160115ubuntu2).
dh-apport is already the newest version (2.20-0ubuntu3).
dh-systemd is already the newest version (1.28ubuntu2).
distro-info is already the newest version (0.14build1).
dnsutils is already the newest version (1:9.10.3.dfsg.P2-4).
firefox is already the newest version (44.0.2+build1-0ubuntu1).
freeipmi-tools is already the newest version (1.4.11-1ubuntu1).
git is already ...

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/maasserver/dns/tests/test_config.py'
--- src/maasserver/dns/tests/test_config.py 2015-12-10 10:31:31 +0000
+++ src/maasserver/dns/tests/test_config.py 2016-02-26 01:38:09 +0000
@@ -413,6 +413,8 @@
413 def assertDNSMatches(self, hostname, domain, ip, version=4):413 def assertDNSMatches(self, hostname, domain, ip, version=4):
414 # A forward lookup on the hostname returns the IP address.414 # A forward lookup on the hostname returns the IP address.
415 fqdn = "%s.%s" % (hostname, domain)415 fqdn = "%s.%s" % (hostname, domain)
416 # Give BIND enough time to process the rndc request.
417 time.sleep(0.2)
416 forward_lookup_result = self.dig_resolve(fqdn, version=version)418 forward_lookup_result = self.dig_resolve(fqdn, version=version)
417 self.expectThat(419 self.expectThat(
418 forward_lookup_result, Contains(ip),420 forward_lookup_result, Contains(ip),
419421
=== modified file 'src/provisioningserver/dns/tests/test_config.py'
--- src/provisioningserver/dns/tests/test_config.py 2015-12-01 18:12:59 +0000
+++ src/provisioningserver/dns/tests/test_config.py 2016-02-26 01:38:09 +0000
@@ -168,7 +168,8 @@
168class TestRNDCUtilities(MAASTestCase):168class TestRNDCUtilities(MAASTestCase):
169169
170 def test_generate_rndc_returns_configurations(self):170 def test_generate_rndc_returns_configurations(self):
171 rndc_content, named_content = generate_rndc()171 rndc_content, named_content = generate_rndc(
172 include_default_controls=False)
172 # rndc_content and named_content look right.173 # rndc_content and named_content look right.
173 self.assertIn('# Start of rndc.conf', rndc_content)174 self.assertIn('# Start of rndc.conf', rndc_content)
174 self.assertIn('controls {', named_content)175 self.assertIn('controls {', named_content)
175176
=== modified file 'src/provisioningserver/utils/fs.py'
--- src/provisioningserver/utils/fs.py 2015-12-01 18:12:59 +0000
+++ src/provisioningserver/utils/fs.py 2016-02-26 01:38:09 +0000
@@ -201,7 +201,7 @@
201 raise201 raise
202202
203203
204def pick_new_mtime(old_mtime=None, starting_age=1000):204def pick_new_mtime(old_mtime=None):
205 """Choose a new modification time for a file that needs it updated.205 """Choose a new modification time for a file that needs it updated.
206206
207 This function is used to manage the modification time of files207 This function is used to manage the modification time of files
@@ -216,29 +216,20 @@
216 time in the past when it is first written, and216 time in the past when it is first written, and
217 increment it by 1 second on each subsequent write.217 increment it by 1 second on each subsequent write.
218218
219 However we also want to be careful not to set the modification time
220 in the future, mostly because BIND does not deal with that very
221 well.
222
223 :param old_mtime: File's previous modification time, as a number219 :param old_mtime: File's previous modification time, as a number
224 with a unity of one second, or None if it did not previously220 with a unity of one second, or None if it did not previously
225 exist.221 exist.
226 :param starting_age: If the file did not exist previously, set its
227 modification time this many seconds in the past.
228 """222 """
229 now = time()223 now = time()
230 if old_mtime is None:224 if old_mtime is None or old_mtime + 1 < now:
231 # File is new. Set modification time in the past to have room for225 # File is new. Set modification time in the past to have room for
232 # sub-second modifications.226 # sub-second modifications.
233 return now - starting_age227 return now
234 elif old_mtime + 1 <= now:228 else:
235 # There is room to increment the file's mtime by one second229 # Let the file timestamp march into the future, so that BIND will
236 # without ending up in the future.230 # reload the zone. Our future selves will notice that mtime is enough
231 # before the then-now to go back to having it match us.
237 return old_mtime + 1232 return old_mtime + 1
238 else:
239 # We can't increase the file's modification time. Give up and
240 # return the previous modification time.
241 return old_mtime
242233
243234
244def incremental_write(content, filename, mode=0o600):235def incremental_write(content, filename, mode=0o600):
245236
=== modified file 'src/provisioningserver/utils/tests/test_fs.py'
--- src/provisioningserver/utils/tests/test_fs.py 2015-12-01 18:12:59 +0000
+++ src/provisioningserver/utils/tests/test_fs.py 2016-02-26 01:38:09 +0000
@@ -258,8 +258,9 @@
258 old_mtime = os.stat(filename).st_mtime - 10258 old_mtime = os.stat(filename).st_mtime - 10
259 os.utime(filename, (old_mtime, old_mtime))259 os.utime(filename, (old_mtime, old_mtime))
260 incremental_write(content, filename)260 incremental_write(content, filename)
261 new_time = time.time()
261 self.assertAlmostEqual(262 self.assertAlmostEqual(
262 os.stat(filename).st_mtime, old_mtime + 1, delta=0.01)263 os.stat(filename).st_mtime, new_time, delta=0.01)
263264
264 def test_incremental_write_sets_permissions(self):265 def test_incremental_write_sets_permissions(self):
265 atomic_file = self.make_file()266 atomic_file = self.make_file()
@@ -295,25 +296,16 @@
295class TestPickNewMTime(MAASTestCase):296class TestPickNewMTime(MAASTestCase):
296 """Test `pick_new_mtime`."""297 """Test `pick_new_mtime`."""
297298
298 def test_pick_new_mtime_applies_starting_age_to_new_file(self):
299 before = time.time()
300 starting_age = randint(0, 5)
301 recommended_age = pick_new_mtime(None, starting_age=starting_age)
302 now = time.time()
303 self.assertAlmostEqual(
304 now - starting_age,
305 recommended_age,
306 delta=(now - before))
307
308 def test_pick_new_mtime_increments_mtime_if_possible(self):299 def test_pick_new_mtime_increments_mtime_if_possible(self):
309 past = time.time() - 2300 now = time.time()
310 self.assertEqual(past + 1, pick_new_mtime(past))301 new_time = pick_new_mtime(now - 2)
302 self.assertAlmostEqual(new_time, now, delta=0.0001)
311303
312 def test_pick_new_mtime_refuses_to_move_mtime_into_the_future(self):304 def test_pick_new_mtime_happily_moves_mtime_into_the_future(self):
313 # Race condition: this will fail if the test gets held up for305 # Race condition: this will fail if the test gets held up for
314 # a second between readings of the clock.306 # a second between readings of the clock.
315 now = time.time()307 now = time.time()
316 self.assertEqual(now, pick_new_mtime(now))308 self.assertEqual(now + 1, pick_new_mtime(now))
317309
318310
319class TestGetMAASProvisionCommand(MAASTestCase):311class TestGetMAASProvisionCommand(MAASTestCase):

Subscribers

People subscribed via source and target branches

to all changes: