]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
test_mutable: test that all servers refusing our share means a publish fails
authorBrian Warner <warner@allmydata.com>
Wed, 23 Apr 2008 01:53:20 +0000 (18:53 -0700)
committerBrian Warner <warner@allmydata.com>
Wed, 23 Apr 2008 01:53:20 +0000 (18:53 -0700)
src/allmydata/test/test_mutable.py

index 987120700667c3a89e2f1fa9803809e7e4c0c181..26a708d554940cf27bf8db25c176a9b463271ac6 100644 (file)
@@ -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
-