From: Zooko O'Whielacronx Date: Mon, 19 Jul 2010 08:16:12 +0000 (-0700) Subject: immutable: add test case of #1128, fix test case of #1118 X-Git-Tag: allmydata-tahoe-1.7.1~2 X-Git-Url: https://git.rkrishnan.org/simplejson/components/%22file:/something?a=commitdiff_plain;h=c076c0b19bcb0f5c4774b7e7110ad78d62f80028;p=tahoe-lafs%2Ftahoe-lafs.git immutable: add test case of #1128, fix test case of #1118 --- diff --git a/src/allmydata/test/test_upload.py b/src/allmydata/test/test_upload.py index 4ccf68a9..917472a2 100644 --- a/src/allmydata/test/test_upload.py +++ b/src/allmydata/test/test_upload.py @@ -1875,6 +1875,47 @@ class EncodingParameters(GridTestMixin, unittest.TestCase, SetDEPMixin, 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) + # Note: actually it should succeed! See + # test_problem_layout_ticket_1128. But ticket 1118 is just to + # make it realize that it has failed, so if it raises + # UploadUnhappinessError then we'll give it the green light + # for now. + d.addCallback(lambda ignored: + self.shouldFail(UploadUnhappinessError, + "test_problem_layout_ticket_1118", + "", + self.g.clients[0].upload, upload.Data("data" * 10000, + convergence=""))) + return d + + def test_problem_layout_ticket_1128(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 @@ -1902,6 +1943,7 @@ class EncodingParameters(GridTestMixin, unittest.TestCase, SetDEPMixin, d.addCallback(lambda ign: self.failUnless(self._has_happy_share_distribution())) return d + test_problem_layout_ticket_1128.todo = "Invent a smarter uploader that uploads successfully in this case." def test_upload_succeeds_with_some_homeless_shares(self): # If the upload is forced to stop trying to place shares before