Changeset 4fc7ef7 in trunk


Ignore:
Timestamp:
2022-03-09T15:57:05Z (3 years ago)
Author:
Itamar Turner-Trauring <itamar@…>
Branches:
master
Children:
ef4f912a
Parents:
f47741a
Message:

Basic HTTP test for aborts.

File:
1 edited

Legend:

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

    rf47741a r4fc7ef7  
    814814    def test_timed_out_upload_allows_reupload(self):
    815815        """
    816         If an in-progress upload times out, it is cancelled, allowing a new
    817         upload to occur.
     816        If an in-progress upload times out, it is cancelled altogether,
     817        allowing a new upload to occur.
     818        """
     819        self._test_abort_or_timed_out_upload_to_existing_storage_index(
     820            lambda **kwargs: self.http.clock.advance(30 * 60 + 1)
     821        )
     822
     823    def test_abort_upload_allows_reupload(self):
     824        """
     825        If an in-progress upload is aborted, it is cancelled altogether,
     826        allowing a new upload to occur.
     827        """
     828
     829        def abort(storage_index, share_number, upload_secret):
     830            return result_of(
     831                self.imm_client.abort_upload(storage_index, share_number, upload_secret)
     832            )
     833
     834        self._test_abort_or_timed_out_upload_to_existing_storage_index(abort)
     835
     836    def _test_abort_or_timed_out_upload_to_existing_storage_index(self, cancel_upload):
     837        """Start uploading to an existing storage index that then times out or aborts.
     838
     839        Re-uploading should work.
    818840        """
    819841        # Start an upload:
     
    829851        )
    830852
    831         # Now, time passes, the in-progress upload should disappear...
    832         self.http.clock.advance(30 * 60 + 1)
     853        # Now, the upload is cancelled somehow:
     854        cancel_upload(
     855            storage_index=storage_index, upload_secret=upload_secret, share_number=1
     856        )
    833857
    834858        # Now we can create a new share with the same storage index without
Note: See TracChangeset for help on using the changeset viewer.