From: Daira Hopwood <david-sarah@jacaranda.org>
Date: Wed, 15 May 2013 03:25:42 +0000 (+0100)
Subject: Add a test for raising NotEnoughSharesError when a Retrieve object is created with... 
X-Git-Tag: allmydata-tahoe-1.10.1a1~242
X-Git-Url: https://git.rkrishnan.org/vdrive/%22news.html/FOOURL?a=commitdiff_plain;h=e821c9e23dd286734e7ebf0fbd17fa1fa5f4ff31;p=tahoe-lafs%2Ftahoe-lafs.git

Add a test for raising NotEnoughSharesError when a Retrieve object is created with an insufficient servermap. refs #1742

Signed-off-by: Daira Hopwood <david-sarah@jacaranda.org>
---

diff --git a/src/allmydata/test/test_mutable.py b/src/allmydata/test/test_mutable.py
index 47f24c72..a8bf4ee1 100644
--- a/src/allmydata/test/test_mutable.py
+++ b/src/allmydata/test/test_mutable.py
@@ -1330,6 +1330,23 @@ class Roundtrip(unittest.TestCase, testutil.ShouldFailMixin, PublishMixin):
         d.addCallback(_remove_shares)
         return d
 
+    def test_all_shares_vanished_new_servermap(self):
+        d = self.make_servermap()
+        def _remove_shares(servermap):
+            self._version = servermap.best_recoverable_version()
+            for shares in self._storage._peers.values()[2:]:
+                shares.clear()
+            return self.make_servermap()
+        d.addCallback(_remove_shares)
+        def _check(new_servermap):
+            d1 = self.shouldFail(NotEnoughSharesError,
+                                 "test_all_shares_vanished",
+                                 "ran out of servers",
+                                 self.do_download, new_servermap, version=self._version)
+            return d1
+        d.addCallback(_check)
+        return d
+
     def test_no_servers(self):
         sb2 = make_storagebroker(num_peers=0)
         # if there are no servers, then a MODE_READ servermap should come