From: Brian Warner Date: Sun, 28 Aug 2011 00:55:42 +0000 (-0700) Subject: test_mutable.Version: exercise 'tahoe debug find-shares' on MDMF. refs #1507 X-Git-Tag: allmydata-tahoe-1.9.0a2~79 X-Git-Url: https://git.rkrishnan.org/pf/content/it.html?a=commitdiff_plain;h=7d48f902fc3c11ad1dff345155e0e935f8f74792;p=tahoe-lafs%2Ftahoe-lafs.git test_mutable.Version: exercise 'tahoe debug find-shares' on MDMF. refs #1507 Also changes NoNetworkGrid to put shares in storage/shares/ . --- diff --git a/src/allmydata/test/no_network.py b/src/allmydata/test/no_network.py index 5654c2ce..abc87b18 100644 --- a/src/allmydata/test/no_network.py +++ b/src/allmydata/test/no_network.py @@ -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): diff --git a/src/allmydata/test/test_mutable.py b/src/allmydata/test/test_mutable.py index 67a9357c..ce91a377 100644 --- a/src/allmydata/test/test_mutable.py +++ b/src/allmydata/test/test_mutable.py @@ -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())