From: Brian Warner Date: Wed, 23 Apr 2008 01:53:20 +0000 (-0700) Subject: test_mutable: test that all servers refusing our share means a publish fails X-Git-Tag: allmydata-tahoe-1.1.0~189 X-Git-Url: https://git.rkrishnan.org/%5B/%5D%20/uri/%22file:/statistics?a=commitdiff_plain;h=a557d44877ebf656673220d8e11576abbda4c6cc;p=tahoe-lafs%2Ftahoe-lafs.git test_mutable: test that all servers refusing our share means a publish fails --- diff --git a/src/allmydata/test/test_mutable.py b/src/allmydata/test/test_mutable.py index 98712070..26a708d5 100644 --- a/src/allmydata/test/test_mutable.py +++ b/src/allmydata/test/test_mutable.py @@ -18,7 +18,8 @@ import sha from allmydata.mutable.node import MutableFileNode, BackoffAgent from allmydata.mutable.common import DictOfSets, ResponseCache, \ MODE_CHECK, MODE_ANYTHING, MODE_WRITE, MODE_READ, \ - NeedMoreDataError, UnrecoverableFileError, UncoordinatedWriteError + NeedMoreDataError, UnrecoverableFileError, UncoordinatedWriteError, \ + NotEnoughServersError from allmydata.mutable.retrieve import Retrieve from allmydata.mutable.publish import Publish from allmydata.mutable.servermap import ServerMap, ServermapUpdater @@ -1515,6 +1516,18 @@ class Problems(unittest.TestCase, testutil.ShouldFailMixin): d.addCallback(lambda res: self.failUnlessEqual(res, "contents 2")) return d + def test_publish_all_servers_bad(self): + # Break all servers: the publish should fail + basedir = os.path.join("mutable/CollidingWrites/publish_all_servers_bad") + self.client = LessFakeClient(basedir, 20) + for connection in self.client._connections.values(): + connection.broken = True + d = self.shouldFail(NotEnoughServersError, + "test_publish_all_servers_bad", + "Ran out of non-bad servers", + self.client.create_mutable_file, "contents") + return d + def test_privkey_query_error(self): # when a servermap is updated with MODE_WRITE, it tries to get the # privkey. Something might go wrong during this query attempt. @@ -1583,4 +1596,3 @@ class Problems(unittest.TestCase, testutil.ShouldFailMixin): return res d.addBoth(_cancel_timer) return d -