From: Kevan Carstensen Date: Wed, 4 Nov 2009 04:36:02 +0000 (-0700) Subject: Alter tests to use the new form of set_shareholders X-Git-Url: https://git.rkrishnan.org/listings/FOOURL?a=commitdiff_plain;h=5ad29d4e8b50e070fbeaaecdd1c61bf85449b1c0;p=tahoe-lafs%2Ftahoe-lafs.git Alter tests to use the new form of set_shareholders --- diff --git a/src/allmydata/test/test_encode.py b/src/allmydata/test/test_encode.py index 82e9056b..fe765579 100644 --- a/src/allmydata/test/test_encode.py +++ b/src/allmydata/test/test_encode.py @@ -298,11 +298,13 @@ class Encode(unittest.TestCase): (NUM_SEGMENTS-1)*segsize, len(data), NUM_SEGMENTS*segsize) shareholders = {} + servermap = {} for shnum in range(NUM_SHARES): peer = FakeBucketReaderWriterProxy() shareholders[shnum] = peer + servermap[shnum] = str(shnum) all_shareholders.append(peer) - e.set_shareholders(shareholders) + e.set_shareholders(shareholders, servermap) return e.start() d.addCallback(_ready) @@ -457,11 +459,13 @@ class Roundtrip(unittest.TestCase, testutil.ShouldFailMixin): def _ready(res): k,happy,n = e.get_param("share_counts") assert n == NUM_SHARES # else we'll be completely confused + all_peers = [] for shnum in range(NUM_SHARES): mode = bucket_modes.get(shnum, "good") peer = FakeBucketReaderWriterProxy(mode) shareholders[shnum] = peer - e.set_shareholders(shareholders) + servermap[shnum] = str(shnum) + e.set_shareholders(shareholders, servermap) return e.start() d.addCallback(_ready) def _sent(res): diff --git a/src/allmydata/test/test_upload.py b/src/allmydata/test/test_upload.py index 2370e489..44be41d8 100644 --- a/src/allmydata/test/test_upload.py +++ b/src/allmydata/test/test_upload.py @@ -708,9 +708,12 @@ class EncodingParameters(GridTestMixin, unittest.TestCase, SetDEPMixin, for share in server.buckets.keys(): server.buckets[share].abort() buckets = {} + servermap = already_peers.copy() for peer in used_peers: buckets.update(peer.buckets) - encoder.set_shareholders(buckets) + for bucket in peer.buckets: + servermap[bucket] = peer.peerid + encoder.set_shareholders(buckets, servermap) d = encoder.start() return d d.addCallback(_have_shareholders) @@ -927,7 +930,6 @@ class EncodingParameters(GridTestMixin, unittest.TestCase, SetDEPMixin, _set_basedir() d = self._setup_and_upload(); # Add 5 servers, with one share each from the original - # Add a readonly server def _do_server_setup(ign): self._add_server_with_share(1, 1, True) self._add_server_with_share(2)