From: robk-tahoe Date: Fri, 18 Jan 2008 03:57:29 +0000 (-0700) Subject: offloaded: fix failure in unit test on windows X-Git-Tag: allmydata-tahoe-0.8.0~293 X-Git-Url: https://git.rkrishnan.org/tahoe_css?a=commitdiff_plain;h=7c34658438a7308300bcd2d82b53018fc45eed9c;p=tahoe-lafs%2Ftahoe-lafs.git offloaded: fix failure in unit test on windows in trying to test my fix for the failure of the offloaded unit test on windows (by closing the reader before unlinking the encoding file - which, perhaps disturbingly doesn't actually make a difference in my windows environment) I was unable too because the unit test failed every time with a connection lost error. after much more time than I'd like to admit it took, I eventually managed to track that down to a part of the unit test which is supposed to be be dropping a connection. it looks like the exceptions that get thrown on unix, or at least all the specific environments brian tested in, for that dropped connection are different from what is thrown on my box (which is running py2.4 and twisted 2.4.0, for reference) adding ConnectionLost to the list of expected exceptions makes the test pass. though curiously still my test logs a NotEnoughWritersError error, and I'm not currently able to fathom why that exception isn't leading to any overall failure of the unit test itself. for general interest, a large part of the time spent trying to track this down was lost to the state of logging. I added a whole bunch of logging to try and track down where the tests were failing, but then spent a bunch of time searching in vain for that log output. as far as I can tell at this point the unit tests are themselves logging to foolscap's log module, but that isn't being directed anywhere, so all the test's logging is being black holed. --- diff --git a/src/allmydata/test/test_system.py b/src/allmydata/test/test_system.py index 518184b0..538d7f6d 100644 --- a/src/allmydata/test/test_system.py +++ b/src/allmydata/test/test_system.py @@ -5,7 +5,7 @@ from cStringIO import StringIO from twisted.trial import unittest from twisted.internet import defer, reactor from twisted.internet import threads # CLI tests use deferToThread -from twisted.internet.error import ConnectionDone +from twisted.internet.error import ConnectionDone, ConnectionLost from twisted.application import service from allmydata import client, uri, download, upload, storage, mutable, offloaded from allmydata.introducer import IntroducerNode @@ -318,7 +318,7 @@ class SystemTest(testutil.SignalMixin, unittest.TestCase): self.fail("interrupted upload should have failed, not finished" " with result %s" % (res,)) def _interrupted(f): - f.trap(ConnectionDone, DeadReferenceError) + f.trap(ConnectionLost, ConnectionDone, DeadReferenceError) reu = u1.debug_RemoteEncryptedUploadable # make sure we actually interrupted it before finishing the # file