summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorVictor Shyba <victor1984@riseup.net>2017-09-26 02:07:53 -0300
committerVictor Shyba <victor1984@riseup.net>2017-10-05 05:41:40 -0300
commitbbc704834bf15798e4bce3e75e3baaebd38a8765 (patch)
tree1f5ddc24064e46d00a873f51f1411bd1d25bd602 /tests
parent703036c34dbea644e7fb104ccaf812b00333bf4d (diff)
[feature] retry during upload + proper wait
Added retry to upload and modified retry implementation to comply with discussed spec. According to it, we should wait between retries, something like 1s, 10s, .. up to 1 minute. -- Resolves: #8822
Diffstat (limited to 'tests')
-rw-r--r--tests/server/test_blobs_server.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/server/test_blobs_server.py b/tests/server/test_blobs_server.py
index f27fa985..e3bc761d 100644
--- a/tests/server/test_blobs_server.py
+++ b/tests/server/test_blobs_server.py
@@ -257,6 +257,29 @@ class BlobServerTestCase(unittest.TestCase):
@defer.inlineCallbacks
@pytest.mark.usefixtures("method_tmpdir")
+ def test_send_missing_retry(self):
+ manager = BlobManager(self.tempdir, self.uri, self.secret,
+ self.secret, uuid4().hex)
+ self.addCleanup(manager.close)
+ blob_id = 'remote_only_blob_id'
+ yield manager.local.put(blob_id, BytesIO("X"), size=1)
+ yield self.port.stopListening()
+
+ def sleep(x):
+ d = defer.Deferred()
+ reactor.callLater(x, d.callback, None)
+ return d
+ d = manager.send_missing()
+ yield sleep(1)
+ self.port = reactor.listenTCP(
+ self.host.port, self.site, interface='127.0.0.1')
+ yield d
+ result = yield manager._download_and_decrypt(blob_id)
+ self.assertIsNotNone(result)
+ self.assertEquals(result[0].getvalue(), "X")
+
+ @defer.inlineCallbacks
+ @pytest.mark.usefixtures("method_tmpdir")
def test_sync_fetch_missing(self):
manager = BlobManager(self.tempdir, self.uri, self.secret,
self.secret, uuid4().hex)