From: Zooko O'Whielacronx Date: Sun, 18 Jul 2010 22:15:37 +0000 (-0700) Subject: immutable: test for #1118 X-Git-Tag: allmydata-tahoe-1.7.1~9 X-Git-Url: https://git.rkrishnan.org/vdrive/install-details.html?a=commitdiff_plain;h=2e83f243c2c2492b69071285ecebd77fbc4bde09;p=tahoe-lafs%2Ftahoe-lafs.git immutable: test for #1118 --- diff --git a/src/allmydata/immutable/upload.py b/src/allmydata/immutable/upload.py index 3f4803af..60e1078f 100644 --- a/src/allmydata/immutable/upload.py +++ b/src/allmydata/immutable/upload.py @@ -916,7 +916,7 @@ class CHKUploader: for shnum in peer.buckets: self._peer_trackers[shnum] = peer servermap.setdefault(shnum, set()).add(peer.peerid) - assert len(buckets) == sum([len(peer.buckets) for peer in used_peers]) + assert len(buckets) == sum([len(peer.buckets) for peer in used_peers]), "%s (%s) != %s (%s)" % (len(buckets), buckets, sum([len(peer.buckets) for peer in used_peers]), [(p.buckets, p.peerid) for p in used_peers]) encoder.set_shareholders(buckets, servermap) def _encrypted_done(self, verifycap): diff --git a/src/allmydata/test/test_upload.py b/src/allmydata/test/test_upload.py index 782f52f4..d3b80aa0 100644 --- a/src/allmydata/test/test_upload.py +++ b/src/allmydata/test/test_upload.py @@ -1786,6 +1786,37 @@ class EncodingParameters(GridTestMixin, unittest.TestCase, SetDEPMixin, return d test_problem_layout_comment_187.todo = "this isn't fixed yet" + def test_problem_layout_ticket_1118(self): + # #1118 includes a report from a user who hit an assertion in + # the upload code with this layout. + self.basedir = self.mktemp() + d = self._setup_and_upload(k=2, n=4) + + # server 0: no shares + # server 1: shares 0, 3 + # server 3: share 1 + # server 2: share 2 + # The order that they get queries is 0, 1, 3, 2 + def _setup(ign): + self._add_server(server_number=0) + self._add_server_with_share(server_number=1, share_number=0) + self._add_server_with_share(server_number=2, share_number=2) + self._add_server_with_share(server_number=3, share_number=1) + # Copy shares + self._copy_share_to_server(3, 1) + storedir = self.get_serverdir(0) + # remove the storedir, wiping out any existing shares + shutil.rmtree(storedir) + # create an empty storedir to replace the one we just removed + os.mkdir(storedir) + client = self.g.clients[0] + client.DEFAULT_ENCODING_PARAMETERS['happy'] = 4 + return client + + d.addCallback(_setup) + d.addCallback(lambda client: + client.upload(upload.Data("data" * 10000, convergence=""))) + return d def test_upload_succeeds_with_some_homeless_shares(self): # If the upload is forced to stop trying to place shares before