]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
test_mutable.Version: exercise 'tahoe debug find-shares' on MDMF. refs #1507
authorBrian Warner <warner@lothar.com>
Sun, 28 Aug 2011 00:55:42 +0000 (17:55 -0700)
committerBrian Warner <warner@lothar.com>
Sun, 28 Aug 2011 00:55:42 +0000 (17:55 -0700)
Also changes NoNetworkGrid to put shares in storage/shares/ .

src/allmydata/test/no_network.py
src/allmydata/test/test_mutable.py

index 5654c2cedfe7da723f2d4a10ac771d9cd199a71e..abc87b182d76eb08bb67ea17ee44b846369a7407 100644 (file)
@@ -248,7 +248,7 @@ class NoNetworkGrid(service.MultiService):
     def make_server(self, i, readonly=False):
         serverid = hashutil.tagged_hash("serverid", str(i))[:20]
         serverdir = os.path.join(self.basedir, "servers",
-                                 idlib.shortnodeid_b2a(serverid))
+                                 idlib.shortnodeid_b2a(serverid), "storage")
         fileutil.make_dirs(serverdir)
         ss = StorageServer(serverdir, serverid, stats_provider=SimpleStats(),
                            readonly_storage=readonly)
@@ -344,7 +344,7 @@ class GridTestMixin:
         shares = []
         for i,ss in self.g.servers_by_number.items():
             serverid = ss.my_nodeid
-            basedir = os.path.join(ss.storedir, "shares", prefixdir)
+            basedir = os.path.join(ss.sharedir, prefixdir)
             if not os.path.exists(basedir):
                 continue
             for f in os.listdir(basedir):
index 67a9357cc0d6ff9229b22478f41819e1cc14d3f4..ce91a3778d668b0da9cc195ca2d3ad43de89e5c9 100644 (file)
@@ -20,6 +20,7 @@ from foolscap.api import eventually, fireEventually
 from foolscap.logging import log
 from allmydata.storage_client import StorageFarmBroker
 from allmydata.storage.common import storage_index_to_dir
+from allmydata.scripts import debug
 
 from allmydata.mutable.filenode import MutableFileNode, BackoffAgent
 from allmydata.mutable.common import ResponseCache, \
@@ -2956,6 +2957,24 @@ class Version(GridTestMixin, unittest.TestCase, testutil.ShouldFailMixin, \
         d.addCallback(lambda ign: self.do_upload_sdmf())
         return d
 
+    def test_debug(self):
+        d = self.do_upload_mdmf()
+        def _debug(n):
+            fso = debug.FindSharesOptions()
+            storage_index = base32.b2a(n.get_storage_index())
+            fso.si_s = storage_index
+            fso.nodedirs = [unicode(os.path.dirname(os.path.abspath(storedir)))
+                            for (i,ss,storedir)
+                            in self.iterate_servers()]
+            fso.stdout = StringIO()
+            fso.stderr = StringIO()
+            debug.find_shares(fso)
+            sharefiles = fso.stdout.getvalue().split()
+            expected = self.nm.default_encoding_parameters["n"]
+            self.failUnlessEqual(len(sharefiles), expected)
+        d.addCallback(_debug)
+        return d
+
     def test_get_sequence_number(self):
         d = self.do_upload()
         d.addCallback(lambda ign: self.mdmf_node.get_best_readable_version())