From 72956174187fa2fccbb060d04d4809797657e029 Mon Sep 17 00:00:00 2001 From: Victor Shyba Date: Fri, 27 Oct 2017 19:39:25 -0300 Subject: [bug] there is no retry limit for usual transfers Retry limit was originally specified in #8825 as a protection mechanism, but #8822 (retry) doesn't specify a retry limit. In fact, blobs is supposed to retry until transfer is complete using timed delays between attempts, but never giving up. -- Related: #8822 -- Related: #8825 --- tests/blobs/test_blob_manager.py | 45 ---------------------------------------- 1 file changed, 45 deletions(-) (limited to 'tests/blobs') diff --git a/tests/blobs/test_blob_manager.py b/tests/blobs/test_blob_manager.py index 4b2b1135..f1872ab1 100644 --- a/tests/blobs/test_blob_manager.py +++ b/tests/blobs/test_blob_manager.py @@ -23,7 +23,6 @@ from leap.soledad.client._document import BlobDoc from leap.soledad.client._db.blobs import BlobManager, FIXED_REV from leap.soledad.client._db.blobs import BlobAlreadyExistsError from leap.soledad.client._db.blobs import SyncStatus -from leap.soledad.client._db.blobs import RetriableTransferError from io import BytesIO from mock import Mock from uuid import uuid4 @@ -167,50 +166,6 @@ class BlobManagerTestCase(unittest.TestCase): local_list = yield self.manager.local_list_status(pending_upload) self.assertIn(blob_id, local_list) - @defer.inlineCallbacks - @pytest.mark.usefixtures("method_tmpdir") - def test_upload_retry_limit(self): - # prepare the manager to fail accordingly - self.manager.remote_list = Mock(return_value=[]) - self.manager._encrypt_and_upload = Mock( - side_effect=RetriableTransferError) - # put a blob in local storage - content, blob_id = "Blob content", uuid4().hex - yield self.manager.local.put(blob_id, BytesIO(content), len(content)) - pending = SyncStatus.PENDING_UPLOAD - yield self.manager.local.update_sync_status(blob_id, pending) - # try to send missing - with pytest.raises(defer.FirstError): - yield self.manager.send_missing() - # assert failed state and number of retries - failed_upload = SyncStatus.FAILED_UPLOAD - local_list = yield self.manager.local_list_status(failed_upload) - self.assertIn(blob_id, local_list) - sync_status, retries = \ - yield self.manager.local.get_sync_status(blob_id) - self.assertEqual(failed_upload, sync_status) - self.assertEqual(self.manager.max_retries, retries) - - @defer.inlineCallbacks - @pytest.mark.usefixtures("method_tmpdir") - def test_download_retry_limit(self): - # prepare the manager to fail accordingly - blob_id = uuid4().hex - self.manager.local_list_status = Mock(return_value=[blob_id]) - self.manager._download_and_decrypt = Mock( - side_effect=RetriableTransferError) - # try to fetch missing - with pytest.raises(defer.FirstError): - yield self.manager.fetch_missing() - # assert failed state and number of retries - failed_download = SyncStatus.FAILED_DOWNLOAD - local_list = yield self.manager.local.list_status(failed_download) - self.assertIn(blob_id, local_list) - sync_status, retries = \ - yield self.manager.local.get_sync_status(blob_id) - self.assertEqual(failed_download, sync_status) - self.assertEqual(self.manager.max_retries, retries) - @defer.inlineCallbacks @pytest.mark.usefixtures("method_tmpdir") def test_local_list_doesnt_include_unavailable_blobs(self): -- cgit v1.2.3