From: Zooko O'Whielacronx Date: Mon, 19 Jul 2010 04:50:47 +0000 (-0700) Subject: immutable: extend the tests to check that the shares that got uploaded really do... X-Git-Tag: allmydata-tahoe-1.7.1~8 X-Git-Url: https://git.rkrishnan.org/Site/Content/Exhibitors/running.html?a=commitdiff_plain;h=1dbfcf753de46e067c6b841dec7e780be2e21ca1;p=tahoe-lafs%2Ftahoe-lafs.git immutable: extend the tests to check that the shares that got uploaded really do make a sufficiently Happy distribution This patch also renames some instances of "find_shares()" to "find_all_shares()" and other instances to "find_uri_shares()" as appropriate -- the conflation between those names confused me at first when writing these tests. --- diff --git a/src/allmydata/test/common.py b/src/allmydata/test/common.py index 9f37073a..fa032ecd 100644 --- a/src/allmydata/test/common.py +++ b/src/allmydata/test/common.py @@ -956,7 +956,7 @@ class ShareManglingMixin(SystemTestMixin): d.addCallback(_stash_it) return d - def find_shares(self, unused=None): + def find_all_shares(self, unused=None): """Locate shares on disk. Returns a dict that maps (clientnum,sharenum) to a string that contains the share container (copied directly from the disk, containing leases etc). You can @@ -981,7 +981,7 @@ class ShareManglingMixin(SystemTestMixin): def replace_shares(self, newshares, storage_index): """Replace shares on disk. Takes a dictionary in the same form - as find_shares() returns.""" + as find_all_shares() returns.""" for i, c in enumerate(self.clients): sharedir = c.getServiceNamed("storage").sharedir @@ -1006,7 +1006,7 @@ class ShareManglingMixin(SystemTestMixin): def _delete_a_share(self, unused=None, sharenum=None): """ Delete one share. """ - shares = self.find_shares() + shares = self.find_all_shares() ks = shares.keys() if sharenum is not None: k = [ key for key in shares.keys() if key[1] == sharenum ][0] @@ -1018,7 +1018,7 @@ class ShareManglingMixin(SystemTestMixin): return unused def _corrupt_a_share(self, unused, corruptor_func, sharenum): - shares = self.find_shares() + shares = self.find_all_shares() ks = [ key for key in shares.keys() if key[1] == sharenum ] assert ks, (shares.keys(), sharenum) k = ks[0] @@ -1028,14 +1028,14 @@ class ShareManglingMixin(SystemTestMixin): def _corrupt_all_shares(self, unused, corruptor_func): """ All shares on disk will be corrupted by corruptor_func. """ - shares = self.find_shares() + shares = self.find_all_shares() for k in shares.keys(): self._corrupt_a_share(unused, corruptor_func, k[1]) return corruptor_func def _corrupt_a_random_share(self, unused, corruptor_func): """ Exactly one share on disk will be corrupted by corruptor_func. """ - shares = self.find_shares() + shares = self.find_all_shares() ks = shares.keys() k = random.choice(ks) self._corrupt_a_share(unused, corruptor_func, k[1]) diff --git a/src/allmydata/test/no_network.py b/src/allmydata/test/no_network.py index 801714e9..771dffd2 100644 --- a/src/allmydata/test/no_network.py +++ b/src/allmydata/test/no_network.py @@ -302,7 +302,7 @@ class GridTestMixin: ss = self.g.servers_by_number[i] yield (i, ss, ss.storedir) - def find_shares(self, uri): + def find_uri_shares(self, uri): si = tahoe_uri.from_string(uri).get_storage_index() prefixdir = storage_index_to_dir(si) shares = [] @@ -323,7 +323,7 @@ class GridTestMixin: os.unlink(sharefile) def delete_shares_numbered(self, uri, shnums): - for (i_shnum, i_serverid, i_sharefile) in self.find_shares(uri): + for (i_shnum, i_serverid, i_sharefile) in self.find_uri_shares(uri): if i_shnum in shnums: os.unlink(i_sharefile) @@ -333,7 +333,7 @@ class GridTestMixin: open(sharefile, "wb").write(corruptdata) def corrupt_shares_numbered(self, uri, shnums, corruptor, debug=False): - for (i_shnum, i_serverid, i_sharefile) in self.find_shares(uri): + for (i_shnum, i_serverid, i_sharefile) in self.find_uri_shares(uri): if i_shnum in shnums: sharedata = open(i_sharefile, "rb").read() corruptdata = corruptor(sharedata, debug=debug) diff --git a/src/allmydata/test/test_cli.py b/src/allmydata/test/test_cli.py index 6ee4d1fe..cec32e42 100644 --- a/src/allmydata/test/test_cli.py +++ b/src/allmydata/test/test_cli.py @@ -1995,7 +1995,7 @@ class Check(GridTestMixin, CLITestMixin, unittest.TestCase): def _clobber_shares(ignored): # delete one, corrupt a second - shares = self.find_shares(self.uri) + shares = self.find_uri_shares(self.uri) self.failUnlessReallyEqual(len(shares), 10) os.unlink(shares[0][2]) cso = debug.CorruptShareOptions() @@ -2120,11 +2120,11 @@ class Check(GridTestMixin, CLITestMixin, unittest.TestCase): d.addCallback(_check_stats) def _clobber_shares(ignored): - shares = self.find_shares(self.uris[u"gööd"]) + shares = self.find_uri_shares(self.uris[u"gööd"]) self.failUnlessReallyEqual(len(shares), 10) os.unlink(shares[0][2]) - shares = self.find_shares(self.uris["mutable"]) + shares = self.find_uri_shares(self.uris["mutable"]) cso = debug.CorruptShareOptions() cso.stdout = StringIO() cso.parseOptions([shares[1][2]]) diff --git a/src/allmydata/test/test_deepcheck.py b/src/allmydata/test/test_deepcheck.py index 6ea8b2de..5168b37e 100644 --- a/src/allmydata/test/test_deepcheck.py +++ b/src/allmydata/test/test_deepcheck.py @@ -991,7 +991,7 @@ class DeepCheckWebBad(DeepCheckBase, unittest.TestCase): self.delete_shares_numbered(node.get_uri(), [0,1]) def _corrupt_some_shares(self, node): - for (shnum, serverid, sharefile) in self.find_shares(node.get_uri()): + for (shnum, serverid, sharefile) in self.find_uri_shares(node.get_uri()): if shnum in (0,1): self._run_cli(["debug", "corrupt-share", sharefile]) diff --git a/src/allmydata/test/test_hung_server.py b/src/allmydata/test/test_hung_server.py index a4f53f81..b1def169 100644 --- a/src/allmydata/test/test_hung_server.py +++ b/src/allmydata/test/test_hung_server.py @@ -64,7 +64,7 @@ class HungServerDownloadTest(GridTestMixin, ShouldFailMixin, unittest.TestCase): os.makedirs(si_dir) new_sharefile = os.path.join(si_dir, str(sharenum)) shutil.copy(sharefile, new_sharefile) - self.shares = self.find_shares(self.uri) + self.shares = self.find_uri_shares(self.uri) # Make sure that the storage server has the share. self.failUnless((sharenum, ss.original.my_nodeid, new_sharefile) in self.shares) @@ -95,14 +95,14 @@ class HungServerDownloadTest(GridTestMixin, ShouldFailMixin, unittest.TestCase): d = nm.create_mutable_file(mutable_plaintext) def _uploaded_mutable(node): self.uri = node.get_uri() - self.shares = self.find_shares(self.uri) + self.shares = self.find_uri_shares(self.uri) d.addCallback(_uploaded_mutable) else: data = upload.Data(immutable_plaintext, convergence="") d = self.c0.upload(data) def _uploaded_immutable(upload_res): self.uri = upload_res.uri - self.shares = self.find_shares(self.uri) + self.shares = self.find_uri_shares(self.uri) d.addCallback(_uploaded_immutable) return d diff --git a/src/allmydata/test/test_immutable.py b/src/allmydata/test/test_immutable.py index a430db27..a7eaa1de 100644 --- a/src/allmydata/test/test_immutable.py +++ b/src/allmydata/test/test_immutable.py @@ -11,7 +11,7 @@ class Test(common.ShareManglingMixin, unittest.TestCase): # replace_shares, and asserting that the new set of shares equals the # old is more to test this test code than to test the Tahoe code... d = defer.succeed(None) - d.addCallback(self.find_shares) + d.addCallback(self.find_all_shares) stash = [None] def _stash_it(res): stash[0] = res diff --git a/src/allmydata/test/test_repairer.py b/src/allmydata/test/test_repairer.py index a4ccf2c3..02264e48 100644 --- a/src/allmydata/test/test_repairer.py +++ b/src/allmydata/test/test_repairer.py @@ -87,7 +87,7 @@ class Verifier(GridTestMixin, unittest.TestCase, RepairTestMixin): d.addCallback(_check) def _remove_all(ignored): - for sh in self.find_shares(self.uri): + for sh in self.find_uri_shares(self.uri): self.delete_share(sh) d.addCallback(_remove_all) @@ -322,7 +322,7 @@ class Verifier(GridTestMixin, unittest.TestCase, RepairTestMixin): def _grab_sh0(res): self.sh0_file = [sharefile for (shnum, serverid, sharefile) - in self.find_shares(self.uri) + in self.find_uri_shares(self.uri) if shnum == 0][0] self.sh0_orig = open(self.sh0_file, "rb").read() d.addCallback(_grab_sh0) @@ -467,11 +467,11 @@ class Repairer(GridTestMixin, unittest.TestCase, RepairTestMixin, self.set_up_grid(num_clients=2) d = self.upload_and_stash() - d.addCallback(lambda ignored: self.find_shares(self.uri)) + d.addCallback(lambda ignored: self.find_uri_shares(self.uri)) def _stash_shares(oldshares): self.oldshares = oldshares d.addCallback(_stash_shares) - d.addCallback(lambda ignored: self.find_shares(self.uri)) + d.addCallback(lambda ignored: self.find_uri_shares(self.uri)) def _compare(newshares): self.failUnlessEqual(newshares, self.oldshares) d.addCallback(_compare) @@ -482,7 +482,7 @@ class Repairer(GridTestMixin, unittest.TestCase, RepairTestMixin, for sh in self.oldshares[1:8]: self.delete_share(sh) d.addCallback(_delete_8) - d.addCallback(lambda ignored: self.find_shares(self.uri)) + d.addCallback(lambda ignored: self.find_uri_shares(self.uri)) d.addCallback(lambda shares: self.failUnlessEqual(len(shares), 2)) d.addCallback(lambda ignored: @@ -499,7 +499,7 @@ class Repairer(GridTestMixin, unittest.TestCase, RepairTestMixin, # test share corruption def _test_corrupt(ignored): olddata = {} - shares = self.find_shares(self.uri) + shares = self.find_uri_shares(self.uri) for (shnum, serverid, sharefile) in shares: olddata[ (shnum, serverid) ] = open(sharefile, "rb").read() for sh in shares: @@ -510,10 +510,10 @@ class Repairer(GridTestMixin, unittest.TestCase, RepairTestMixin, d.addCallback(_test_corrupt) def _remove_all(ignored): - for sh in self.find_shares(self.uri): + for sh in self.find_uri_shares(self.uri): self.delete_share(sh) d.addCallback(_remove_all) - d.addCallback(lambda ignored: self.find_shares(self.uri)) + d.addCallback(lambda ignored: self.find_uri_shares(self.uri)) d.addCallback(lambda shares: self.failUnlessEqual(shares, [])) return d @@ -544,7 +544,7 @@ class Repairer(GridTestMixin, unittest.TestCase, RepairTestMixin, # Now we inspect the filesystem to make sure that it has 10 # shares. - shares = self.find_shares(self.uri) + shares = self.find_uri_shares(self.uri) self.failIf(len(shares) < 10) d.addCallback(_check_results) @@ -589,7 +589,7 @@ class Repairer(GridTestMixin, unittest.TestCase, RepairTestMixin, self.failUnless(post.is_healthy(), post.data) # Make sure we really have 10 shares. - shares = self.find_shares(self.uri) + shares = self.find_uri_shares(self.uri) self.failIf(len(shares) < 10) d.addCallback(_check_results) @@ -650,7 +650,7 @@ class Repairer(GridTestMixin, unittest.TestCase, RepairTestMixin, def OFF_test_repair_from_corruption_of_1(self): d = defer.succeed(None) - d.addCallback(self.find_shares) + d.addCallback(self.find_all_shares) stash = [None] def _stash_it(res): stash[0] = res @@ -685,7 +685,7 @@ class Repairer(GridTestMixin, unittest.TestCase, RepairTestMixin, # Now we inspect the filesystem to make sure that it has 10 # shares. - shares = self.find_shares() + shares = self.find_all_shares() self.failIf(len(shares) < 10) # Now we assert that the verifier reports the file as healthy. diff --git a/src/allmydata/test/test_system.py b/src/allmydata/test/test_system.py index 0ad6c358..3351102c 100644 --- a/src/allmydata/test/test_system.py +++ b/src/allmydata/test/test_system.py @@ -383,7 +383,7 @@ class SystemTest(SystemTestMixin, unittest.TestCase): return d - def _find_shares(self, basedir): + def _find_all_shares(self, basedir): shares = [] for (dirpath, dirnames, filenames) in os.walk(basedir): if "storage" not in dirpath: @@ -475,7 +475,7 @@ class SystemTest(SystemTestMixin, unittest.TestCase): def _test_debug(res): # find a share. It is important to run this while there is only # one slot in the grid. - shares = self._find_shares(self.basedir) + shares = self._find_all_shares(self.basedir) (client_num, storage_index, filename, shnum) = shares[0] log.msg("test_system.SystemTest.test_mutable._test_debug using %s" % filename) @@ -578,7 +578,7 @@ class SystemTest(SystemTestMixin, unittest.TestCase): def _corrupt_shares(res): # run around and flip bits in all but k of the shares, to test # the hash checks - shares = self._find_shares(self.basedir) + shares = self._find_all_shares(self.basedir) ## sort by share number #shares.sort( lambda a,b: cmp(a[3], b[3]) ) where = dict([ (shnum, filename) diff --git a/src/allmydata/test/test_upload.py b/src/allmydata/test/test_upload.py index d3b80aa0..4ccf68a9 100644 --- a/src/allmydata/test/test_upload.py +++ b/src/allmydata/test/test_upload.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + import os, shutil from cStringIO import StringIO from twisted.trial import unittest @@ -684,8 +686,66 @@ class StorageIndex(unittest.TestCase): d.addCallback(_done) return d +# copied from python docs because itertools.combinations was added in +# python 2.6 and we support >= 2.4. +def combinations(iterable, r): + # combinations('ABCD', 2) --> AB AC AD BC BD CD + # combinations(range(4), 3) --> 012 013 023 123 + pool = tuple(iterable) + n = len(pool) + if r > n: + return + indices = range(r) + yield tuple(pool[i] for i in indices) + while True: + for i in reversed(range(r)): + if indices[i] != i + n - r: + break + else: + return + indices[i] += 1 + for j in range(i+1, r): + indices[j] = indices[j-1] + 1 + yield tuple(pool[i] for i in indices) + +def is_happy_enough(servertoshnums, h, k): + """ I calculate whether servertoshnums achieves happiness level h. I do this with a naïve "brute force search" approach. (See src/allmydata/util/happinessutil.py for a better algorithm.) """ + if len(servertoshnums) < h: + return False + # print "servertoshnums: ", servertoshnums, h, k + for happysetcombo in combinations(servertoshnums.iterkeys(), h): + # print "happysetcombo: ", happysetcombo + for subsetcombo in combinations(happysetcombo, k): + shnums = reduce(set.union, [ servertoshnums[s] for s in subsetcombo ]) + # print "subsetcombo: ", subsetcombo, ", shnums: ", shnums + if len(shnums) < k: + # print "NOT HAAPP{Y", shnums, k + return False + # print "HAAPP{Y" + return True + class EncodingParameters(GridTestMixin, unittest.TestCase, SetDEPMixin, ShouldFailMixin): + def find_all_shares(self, unused=None): + """Locate shares on disk. Returns a dict that maps + server to set of sharenums. + """ + assert self.g, "I tried to find a grid at self.g, but failed" + servertoshnums = {} # k: server, v: set(shnum) + + for i, c in self.g.servers_by_number.iteritems(): + for (dirp, dirns, fns) in os.walk(c.sharedir): + for fn in fns: + try: + sharenum = int(fn) + except TypeError: + # Whoops, I guess that's not a share file then. + pass + else: + servertoshnums.setdefault(i, set()).add(sharenum) + + return servertoshnums + def _do_upload_with_broken_servers(self, servers_to_break): """ I act like a normal upload, but before I send the results of @@ -729,6 +789,11 @@ class EncodingParameters(GridTestMixin, unittest.TestCase, SetDEPMixin, d.addCallback(_have_shareholders) return d + def _has_happy_share_distribution(self): + servertoshnums = self.find_all_shares() + k = self.g.clients[0].DEFAULT_ENCODING_PARAMETERS['k'] + h = self.g.clients[0].DEFAULT_ENCODING_PARAMETERS['happy'] + return is_happy_enough(servertoshnums, h, k) def _add_server(self, server_number, readonly=False): assert self.g, "I tried to find a grid at self.g, but failed" @@ -760,7 +825,7 @@ class EncodingParameters(GridTestMixin, unittest.TestCase, SetDEPMixin, str(share_number)) if old_share_location != new_share_location: shutil.copy(old_share_location, new_share_location) - shares = self.find_shares(self.uri) + shares = self.find_uri_shares(self.uri) # Make sure that the storage server has the share. self.failUnless((share_number, ss.my_nodeid, new_share_location) in shares) @@ -790,7 +855,7 @@ class EncodingParameters(GridTestMixin, unittest.TestCase, SetDEPMixin, self.uri = ur.uri d.addCallback(_store_uri) d.addCallback(lambda ign: - self.find_shares(self.uri)) + self.find_uri_shares(self.uri)) def _store_shares(shares): self.shares = shares d.addCallback(_store_shares) @@ -876,6 +941,8 @@ class EncodingParameters(GridTestMixin, unittest.TestCase, SetDEPMixin, d.addCallback(lambda ign: self._add_server(4, False)) # and this time the upload ought to succeed d.addCallback(lambda ign: c.upload(DATA)) + d.addCallback(lambda ign: + self.failUnless(self._has_happy_share_distribution())) return d @@ -1012,6 +1079,8 @@ class EncodingParameters(GridTestMixin, unittest.TestCase, SetDEPMixin, d.addCallback(_reset_encoding_parameters) d.addCallback(lambda client: client.upload(upload.Data("data" * 10000, convergence=""))) + d.addCallback(lambda ign: + self.failUnless(self._has_happy_share_distribution())) # This scenario is basically comment:53, but changed so that the @@ -1050,6 +1119,8 @@ class EncodingParameters(GridTestMixin, unittest.TestCase, SetDEPMixin, d.addCallback(_reset_encoding_parameters) d.addCallback(lambda client: client.upload(upload.Data("data" * 10000, convergence=""))) + d.addCallback(lambda ign: + self.failUnless(self._has_happy_share_distribution())) # Try the same thing, but with empty servers after the first one @@ -1081,6 +1152,8 @@ class EncodingParameters(GridTestMixin, unittest.TestCase, SetDEPMixin, # servers of happiness were pushed. d.addCallback(lambda results: self.failUnlessEqual(results.pushed_shares, 3)) + d.addCallback(lambda ign: + self.failUnless(self._has_happy_share_distribution())) return d def test_problem_layout_ticket1124(self): @@ -1106,6 +1179,8 @@ class EncodingParameters(GridTestMixin, unittest.TestCase, SetDEPMixin, d.addCallback(_setup) d.addCallback(lambda client: client.upload(upload.Data("data" * 10000, convergence=""))) + d.addCallback(lambda ign: + self.failUnless(self._has_happy_share_distribution())) return d test_problem_layout_ticket1124.todo = "Fix this after 1.7.1 release." @@ -1143,6 +1218,8 @@ class EncodingParameters(GridTestMixin, unittest.TestCase, SetDEPMixin, d.addCallback(_reset_encoding_parameters) d.addCallback(lambda client: client.upload(upload.Data("data" * 10000, convergence=""))) + d.addCallback(lambda ign: + self.failUnless(self._has_happy_share_distribution())) return d @@ -1180,6 +1257,8 @@ class EncodingParameters(GridTestMixin, unittest.TestCase, SetDEPMixin, d.addCallback(_reset_encoding_parameters) d.addCallback(lambda client: client.upload(upload.Data("data" * 10000, convergence=""))) + d.addCallback(lambda ign: + self.failUnless(self._has_happy_share_distribution())) return d @@ -1489,6 +1568,8 @@ class EncodingParameters(GridTestMixin, unittest.TestCase, SetDEPMixin, d.addCallback(_prepare_client) d.addCallback(lambda client: client.upload(upload.Data("data" * 10000, convergence=""))) + d.addCallback(lambda ign: + self.failUnless(self._has_happy_share_distribution())) return d @@ -1783,6 +1864,8 @@ class EncodingParameters(GridTestMixin, unittest.TestCase, SetDEPMixin, d.addCallback(_setup) d.addCallback(lambda client: client.upload(upload.Data("data" * 10000, convergence=""))) + d.addCallback(lambda ign: + self.failUnless(self._has_happy_share_distribution())) return d test_problem_layout_comment_187.todo = "this isn't fixed yet" @@ -1816,6 +1899,8 @@ class EncodingParameters(GridTestMixin, unittest.TestCase, SetDEPMixin, d.addCallback(_setup) d.addCallback(lambda client: client.upload(upload.Data("data" * 10000, convergence=""))) + d.addCallback(lambda ign: + self.failUnless(self._has_happy_share_distribution())) return d def test_upload_succeeds_with_some_homeless_shares(self): @@ -1852,6 +1937,8 @@ class EncodingParameters(GridTestMixin, unittest.TestCase, SetDEPMixin, d.addCallback(_server_setup) d.addCallback(lambda client: client.upload(upload.Data("data" * 10000, convergence=""))) + d.addCallback(lambda ign: + self.failUnless(self._has_happy_share_distribution())) return d @@ -1879,6 +1966,8 @@ class EncodingParameters(GridTestMixin, unittest.TestCase, SetDEPMixin, d.addCallback(_server_setup) d.addCallback(lambda client: client.upload(upload.Data("data" * 10000, convergence=""))) + d.addCallback(lambda ign: + self.failUnless(self._has_happy_share_distribution())) return d diff --git a/src/allmydata/test/test_web.py b/src/allmydata/test/test_web.py index 43278fd5..37708641 100644 --- a/src/allmydata/test/test_web.py +++ b/src/allmydata/test/test_web.py @@ -3195,14 +3195,14 @@ class Grid(GridTestMixin, WebErrorMixin, ShouldFailMixin, testutil.ReallyEqualMi d.addCallback(_compute_fileurls) def _clobber_shares(ignored): - good_shares = self.find_shares(self.uris["good"]) + good_shares = self.find_uri_shares(self.uris["good"]) self.failUnlessReallyEqual(len(good_shares), 10) - sick_shares = self.find_shares(self.uris["sick"]) + sick_shares = self.find_uri_shares(self.uris["sick"]) os.unlink(sick_shares[0][2]) - dead_shares = self.find_shares(self.uris["dead"]) + dead_shares = self.find_uri_shares(self.uris["dead"]) for i in range(1, 10): os.unlink(dead_shares[i][2]) - c_shares = self.find_shares(self.uris["corrupt"]) + c_shares = self.find_uri_shares(self.uris["corrupt"]) cso = CorruptShareOptions() cso.stdout = StringIO() cso.parseOptions([c_shares[0][2]]) @@ -3336,14 +3336,14 @@ class Grid(GridTestMixin, WebErrorMixin, ShouldFailMixin, testutil.ReallyEqualMi d.addCallback(_compute_fileurls) def _clobber_shares(ignored): - good_shares = self.find_shares(self.uris["good"]) + good_shares = self.find_uri_shares(self.uris["good"]) self.failUnlessReallyEqual(len(good_shares), 10) - sick_shares = self.find_shares(self.uris["sick"]) + sick_shares = self.find_uri_shares(self.uris["sick"]) os.unlink(sick_shares[0][2]) - dead_shares = self.find_shares(self.uris["dead"]) + dead_shares = self.find_uri_shares(self.uris["dead"]) for i in range(1, 10): os.unlink(dead_shares[i][2]) - c_shares = self.find_shares(self.uris["corrupt"]) + c_shares = self.find_uri_shares(self.uris["corrupt"]) cso = CorruptShareOptions() cso.stdout = StringIO() cso.parseOptions([c_shares[0][2]]) @@ -3404,7 +3404,7 @@ class Grid(GridTestMixin, WebErrorMixin, ShouldFailMixin, testutil.ReallyEqualMi d.addCallback(_compute_fileurls) def _clobber_shares(ignored): - sick_shares = self.find_shares(self.uris["sick"]) + sick_shares = self.find_uri_shares(self.uris["sick"]) os.unlink(sick_shares[0][2]) d.addCallback(_clobber_shares) @@ -3894,15 +3894,15 @@ class Grid(GridTestMixin, WebErrorMixin, ShouldFailMixin, testutil.ReallyEqualMi #d.addCallback(_stash_uri, "corrupt") def _clobber_shares(ignored): - good_shares = self.find_shares(self.uris["good"]) + good_shares = self.find_uri_shares(self.uris["good"]) self.failUnlessReallyEqual(len(good_shares), 10) - sick_shares = self.find_shares(self.uris["sick"]) + sick_shares = self.find_uri_shares(self.uris["sick"]) os.unlink(sick_shares[0][2]) - #dead_shares = self.find_shares(self.uris["dead"]) + #dead_shares = self.find_uri_shares(self.uris["dead"]) #for i in range(1, 10): # os.unlink(dead_shares[i][2]) - #c_shares = self.find_shares(self.uris["corrupt"]) + #c_shares = self.find_uri_shares(self.uris["corrupt"]) #cso = CorruptShareOptions() #cso.stdout = StringIO() #cso.parseOptions([c_shares[0][2]]) @@ -3958,7 +3958,7 @@ class Grid(GridTestMixin, WebErrorMixin, ShouldFailMixin, testutil.ReallyEqualMi def _count_leases(self, ignored, which): u = self.uris[which] - shares = self.find_shares(u) + shares = self.find_uri_shares(u) lease_counts = [] for shnum, serverid, fn in shares: sf = get_share_file(fn)