From: Brian Warner <warner@allmydata.com>
Date: Fri, 29 Jun 2007 02:20:28 +0000 (-0700)
Subject: test_system: stall for a second while bouncing the client, it might help windows
X-Git-Tag: allmydata-tahoe-0.4.0~10
X-Git-Url: https://git.rkrishnan.org/%5B/nxhtml.html?a=commitdiff_plain;h=9d47c2524e6352c7f2c63494a19d6a1147e4d6fb;p=tahoe-lafs%2Ftahoe-lafs.git

test_system: stall for a second while bouncing the client, it might help windows
---

diff --git a/src/allmydata/test/test_system.py b/src/allmydata/test/test_system.py
index ec445271..e563eae3 100644
--- a/src/allmydata/test/test_system.py
+++ b/src/allmydata/test/test_system.py
@@ -289,6 +289,11 @@ class SystemTest(testutil.SignalMixin, unittest.TestCase):
         d = old_client0.disownServiceParent()
         assert isinstance(d, defer.Deferred)
         d.addCallback(self.log, "STOPPED")
+        # I think windows requires a moment to let the connection really stop
+        # and the port number made available for re-use. TODO: examine the
+        # behavior, see if this is really the problem, see if we can do
+        # better than blindly waiting for a second.
+        d.addCallback(self.stall, 1.0)
         def _stopped(res):
             new_client0 = client.Client(basedir=self.getdir("client0"))
             self.add_service(new_client0)
@@ -310,6 +315,11 @@ class SystemTest(testutil.SignalMixin, unittest.TestCase):
         log.msg(msg)
         return res
 
+    def stall(self, res, delay=1.0):
+        d = defer.Deferred()
+        reactor.callLater(delay, d.callback, res)
+        return d
+
     def _do_publish_private(self, res):
         ut = upload.Data(self.data)
         vdrive0 = self.clients[0].getServiceNamed("vdrive")