| 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 | |