From: Brian Warner Date: Thu, 14 Jun 2012 19:17:55 +0000 (-0700) Subject: test/common.py: fix race condition waiting for the helper connection X-Git-Url: https://git.rkrishnan.org/components/com_hotproperty/?a=commitdiff_plain;h=b2dcbbb62dc759d47c643bea4fae440180055d8d;p=tahoe-lafs%2Ftahoe-lafs.git test/common.py: fix race condition waiting for the helper connection The wait_for_connections() method, which is used at the start of test_system to make sure that all the clients are connected to all the servers, did not also wait for clients to be connected to their Helpers. Every once in a while, the helper connection would take a bit longer, and then test_system.SystemTest.test_filesystem._test_web._got_welcome_helper would fail, because we'd check for a helper connection before it was ready. The fix is to modify wait_for_connections's polling predicate to look for helper connections (if configured) as well as the regular introducer- and server- connections. Tested by temporarily adding a large (30s) delay to the connectTo() call in Uploader.startService, simulating a long helper connection-establishment delay. This makes the test fail consistently. Then I fixed wait_for_connections(), and the test passed (slowly). Then I removed the delay. Closes #1467 --- diff --git a/src/allmydata/test/common.py b/src/allmydata/test/common.py index deb9d139..e9103a2a 100644 --- a/src/allmydata/test/common.py +++ b/src/allmydata/test/common.py @@ -675,12 +675,12 @@ class SystemTestMixin(pollmixin.PollMixin, testutil.StallMixin): sb = c.get_storage_broker() if len(sb.get_connected_servers()) != self.numclients: return False + up = c.getServiceNamed("uploader") + if up._helper_furl and not up._helper: + return False return True def wait_for_connections(self, ignored=None): - # TODO: replace this with something that takes a list of peerids and - # fires when they've all been heard from, instead of using a count - # and a threshold return self.poll(self._check_connections, timeout=200)