]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
Alter tests to use the new form of set_shareholders
authorKevan Carstensen <kevan@isnotajoke.com>
Wed, 4 Nov 2009 04:36:02 +0000 (21:36 -0700)
committerKevan Carstensen <kevan@isnotajoke.com>
Wed, 4 Nov 2009 04:36:02 +0000 (21:36 -0700)
src/allmydata/test/test_encode.py
src/allmydata/test/test_upload.py

index 82e9056b94113f671d9bd645da61077d6ffe1723..fe76557932492a046d3d05764fc06e60f61afedc 100644 (file)
@@ -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):
index 2370e489d379ceb63dfe52729ba5483480824f4d..44be41d8fff9ca6d1dc4e6680c17bad5c45acd73 100644 (file)
@@ -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)