Changeset 054c4553 in trunk


Ignore:
Timestamp:
2010-07-16T00:10:46Z (15 years ago)
Author:
Kevan Carstensen <kevan@…>
Branches:
master
Children:
16bb529
Parents:
677f3b1f
Message:

test/test_upload.py: test to see that aborted buckets are ignored by the storage server

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified src/allmydata/test/test_upload.py

    r677f3b1f r054c4553  
    18061806
    18071807
     1808    def test_peer_selector_bucket_abort(self):
     1809        # If peer selection for an upload fails due to an unhappy
     1810        # layout, the peer selection process should abort the buckets it
     1811        # allocates before failing, so that the space can be re-used.
     1812        self.basedir = self.mktemp()
     1813        self.set_up_grid(num_servers=5)
     1814
     1815        # Try to upload a file with happy=7, which is unsatisfiable with
     1816        # the current grid. This will fail, but should not take up any
     1817        # space on the storage servers after it fails.
     1818        client = self.g.clients[0]
     1819        client.DEFAULT_ENCODING_PARAMETERS['happy'] = 7
     1820        d = defer.succeed(None)
     1821        d.addCallback(lambda ignored:
     1822            self.shouldFail(UploadUnhappinessError,
     1823                            "test_peer_selection_bucket_abort",
     1824                            "",
     1825                            client.upload, upload.Data("data" * 10000,
     1826                                                       convergence="")))
     1827        # wait for the abort messages to get there.
     1828        def _turn_barrier(res):
     1829            return fireEventually(res)
     1830        d.addCallback(_turn_barrier)
     1831        def _then(ignored):
     1832            for server in self.g.servers_by_number.values():
     1833                self.failUnlessEqual(server.allocated_size(), 0)
     1834        d.addCallback(_then)
     1835        return d
     1836
     1837
     1838    def test_encoder_bucket_abort(self):
     1839        # If enough servers die in the process of encoding and uploading
     1840        # a file to make the layout unhappy, we should cancel the
     1841        # newly-allocated buckets before dying.
     1842        self.basedir = self.mktemp()
     1843        self.set_up_grid(num_servers=4)
     1844
     1845        client = self.g.clients[0]
     1846        client.DEFAULT_ENCODING_PARAMETERS['happy'] = 7
     1847
     1848        d = defer.succeed(None)
     1849        d.addCallback(lambda ignored:
     1850            self.shouldFail(UploadUnhappinessError,
     1851                            "test_encoder_bucket_abort",
     1852                            "",
     1853                            self._do_upload_with_broken_servers, 1))
     1854        def _turn_barrier(res):
     1855            return fireEventually(res)
     1856        d.addCallback(_turn_barrier)
     1857        def _then(ignored):
     1858            for server in self.g.servers_by_number.values():
     1859                self.failUnlessEqual(server.allocated_size(), 0)
     1860        d.addCallback(_then)
     1861        return d
     1862
     1863
    18081864    def _set_up_nodes_extra_config(self, clientdir):
    18091865        cfgfn = os.path.join(clientdir, "tahoe.cfg")
Note: See TracChangeset for help on using the changeset viewer.