From b9121e045fe2894c93c68153013c22b5ab8d2cfd Mon Sep 17 00:00:00 2001
From: david-sarah <david-sarah@jacaranda.org>
Date: Sat, 6 Aug 2011 16:18:42 -0700
Subject: [PATCH] test_runner.py: fix a race condition in the test when
 NODE_URL_FILE is written before PORTNUM_FILE. refs #1469

---
 src/allmydata/test/test_runner.py | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/allmydata/test/test_runner.py b/src/allmydata/test/test_runner.py
index 72be9fef..db2078d3 100644
--- a/src/allmydata/test/test_runner.py
+++ b/src/allmydata/test/test_runner.py
@@ -426,13 +426,12 @@ class RunNode(common_util.SignalMixin, unittest.TestCase, pollmixin.PollMixin,
         # so poll until it is. This time INTRODUCER_FURL_FILE already
         # exists, so we check for the existence of NODE_URL_FILE instead.
         def _node_has_restarted():
-            return os.path.exists(NODE_URL_FILE)
+            return os.path.exists(NODE_URL_FILE) and os.path.exists(PORTNUM_FILE)
         d.addCallback(lambda res: self.poll(_node_has_restarted))
 
         def _check_same_furl_and_port(res):
             self.failUnless(os.path.exists(INTRODUCER_FURL_FILE))
             self.failUnlessEqual(self.furl, fileutil.read(INTRODUCER_FURL_FILE))
-            self.failUnless(os.path.exists(PORTNUM_FILE))
             self.failUnlessEqual(self.portnum, fileutil.read(PORTNUM_FILE))
         d.addCallback(_check_same_furl_and_port)
 
@@ -584,7 +583,7 @@ class RunNode(common_util.SignalMixin, unittest.TestCase, pollmixin.PollMixin,
         d.addCallback(_cb2)
 
         def _node_has_started():
-            return os.path.exists(NODE_URL_FILE)
+            return os.path.exists(NODE_URL_FILE) and os.path.exists(PORTNUM_FILE)
         d.addCallback(lambda res: self.poll(_node_has_started))
 
         def _started(res):
-- 
2.45.2