diff options
author | drebs <drebs@leap.se> | 2017-12-12 13:16:18 -0200 |
---|---|---|
committer | drebs <drebs@leap.se> | 2017-12-12 13:16:23 -0200 |
commit | 1c533260d94e03da59d46d507b1ed611fbae7011 (patch) | |
tree | e9a377058b5c3679c1b93dc56711a7989513d1f7 /tests | |
parent | 94bf542ada220b58d7c9de094aeda383c48d2dfa (diff) |
[test] fix bug in blobs fs backend benchmark test
The new benchmark test for blobs fs backend was rebased from a merge
request in which it was written using the new interface for blobs
backend. After rebase, the test was not reverted to old interface, and
was just failing bad. This commit fixes it.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/benchmarks/test_blobs_fs_backend.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/tests/benchmarks/test_blobs_fs_backend.py b/tests/benchmarks/test_blobs_fs_backend.py index 58031da2..d3a663d2 100644 --- a/tests/benchmarks/test_blobs_fs_backend.py +++ b/tests/benchmarks/test_blobs_fs_backend.py @@ -2,6 +2,7 @@ import pytest from io import BytesIO from leap.soledad.server._blobs import FilesystemBlobsBackend from twisted.internet import defer +from twisted.web.test.test_web import DummyRequest def create_write_test(amount, size): @@ -14,7 +15,9 @@ def create_write_test(amount, size): deferreds = [] for i in xrange(amount): fd = BytesIO(data) - d = backend.write_blob('user', str(i), fd) + request = DummyRequest(['']) + request.content = fd + d = backend.write_blob('user', str(i), request) deferreds.append(d) yield txbenchmark(defer.gatherResults, deferreds) @@ -39,16 +42,19 @@ def create_read_test(amount, size): deferreds = [] for i in xrange(amount): fd = BytesIO(data) - d = backend.write_blob('user', str(i), fd) + request = DummyRequest(['']) + request.content = fd + d = backend.write_blob('user', str(i), request) deferreds.append(d) yield defer.gatherResults(deferreds) # ... then measure the read operation deferreds = [] for i in xrange(amount): - d = backend.read_blob('user', str(i)) - d.addCallback(lambda fd: fd.read()) + request = DummyRequest(['']) + d = request.notifyFinish() deferreds.append(d) + backend.read_blob('user', str(i), request) yield txbenchmark(defer.gatherResults, deferreds) return test |