Ticket #1117: test-1117.diff

File test-1117.diff, 1.6 KB (added by warner, at 2010-07-18T05:08:20Z)

test case to check that the code fails without the abort-shares patch

  • src/allmydata/test/test_upload.py

    diff --git a/src/allmydata/test/test_upload.py b/src/allmydata/test/test_upload.py
    index 52e5aed..2712132 100644
    a b class EncodingParameters(GridTestMixin, unittest.TestCase, SetDEPMixin, 
    851851            self.u.upload(DATA))
    852852        return d
    853853
     854    def test_aborted_shares(self):
     855        self.basedir = "upload/EncodingParameters/aborted_shares"
     856        self.set_up_grid(num_servers=4)
     857        c = self.g.clients[0]
     858        DATA = upload.Data(100* "kittens", convergence="")
     859        # These parameters are unsatisfiable with only 4 servers, but should
     860        # work with 5, as long as the original 4 are not stuck in the open
     861        # BucketWriter state (open() but not
     862        parms = {"k":2, "happy":5, "n":5, "max_segment_size": 1*MiB}
     863        c.DEFAULT_ENCODING_PARAMETERS = parms
     864        d = self.shouldFail(UploadUnhappinessError, "test_aborted_shares",
     865                            "shares could be placed on only 4 "
     866                            "server(s) such that any 2 of them have enough "
     867                            "shares to recover the file, but we were asked "
     868                            "to place shares on at least 5 such servers",
     869                            c.upload, DATA)
     870        # now add the 5th server
     871        d.addCallback(lambda ign: self._add_server(4, False))
     872        # and this time the upload ought to succeed
     873        d.addCallback(lambda ign: c.upload(DATA))
     874        return d
     875
    854876
    855877    def test_problem_layout_comment_52(self):
    856878        def _basedir():