From: david-sarah Date: Wed, 3 Aug 2011 01:27:04 +0000 (-0700) Subject: test_runner.py: modify RunNode.test_introducer to test that starting an introducer... X-Git-Url: https://git.rkrishnan.org/%5B/frontends/%22news.html/?a=commitdiff_plain;h=e74387f4f15e6839f1afaf857b8518afd82c002e;p=tahoe-lafs%2Ftahoe-lafs.git test_runner.py: modify RunNode.test_introducer to test that starting an introducer works when the introducer.furl file already exists. refs #1385 --- diff --git a/src/allmydata/test/test_runner.py b/src/allmydata/test/test_runner.py index 048e19d7..6dfa7ee2 100644 --- a/src/allmydata/test/test_runner.py +++ b/src/allmydata/test/test_runner.py @@ -394,8 +394,7 @@ class RunNode(common_util.SignalMixin, unittest.TestCase, pollmixin.PollMixin, def _started(res): open(HOTLINE_FILE, "w").write("") self.failUnless(os.path.exists(TWISTD_PID_FILE)) - # rm this so we can detect when the second incarnation is ready - os.unlink(INTRODUCER_FURL_FILE) + self.stash_mtime = os.stat(INTRODUCER_FURL_FILE).st_mtime return self.run_bintahoe(["--quiet", "restart", c1]) d.addCallback(_started) @@ -409,8 +408,13 @@ class RunNode(common_util.SignalMixin, unittest.TestCase, pollmixin.PollMixin, d.addCallback(_then) # again, the second incarnation of the node might not be ready yet, - # so poll until it is - d.addCallback(lambda res: self.poll(_node_has_started)) + # so poll until it is. This time the INTRODUCER_FURL_FILE already + # existed (and we couldn't delete it because we wanted to check whether + # its existence caused an error), so we check whether its mtime has + # changed. + def _node_has_restarted(): + return os.stat(INTRODUCER_FURL_FILE).st_mtime != self.stash_mtime + d.addCallback(lambda res: self.poll(_node_has_restarted)) # now we can kill it. TODO: On a slow machine, the node might kill # itself before we get a chance too, especially if spawning the