diff options
author | drebs <drebs@riseup.net> | 2017-10-12 11:40:41 -0300 |
---|---|---|
committer | drebs <drebs@riseup.net> | 2017-10-12 14:34:11 -0300 |
commit | 2bd21dd9d9fc1e2ff66f3d923a55558dc6972fc9 (patch) | |
tree | 9106a631f246bfbbb28851a2f500af1825ca02a3 /tests | |
parent | 3efdb6e197348d2c2774adfaca8faf2d1976bc94 (diff) |
[test] remove now unneeded semaphored from benchmarks
With the introduction of semaphores in the blobmanager level, there's no
need for them in the benchmark tests now.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/benchmarks/test_blobs_sqlite_backend.py | 8 | ||||
-rw-r--r-- | tests/benchmarks/test_blobs_upload_download.py | 20 |
2 files changed, 7 insertions, 21 deletions
diff --git a/tests/benchmarks/test_blobs_sqlite_backend.py b/tests/benchmarks/test_blobs_sqlite_backend.py index 8c6caa66..7dd51360 100644 --- a/tests/benchmarks/test_blobs_sqlite_backend.py +++ b/tests/benchmarks/test_blobs_sqlite_backend.py @@ -5,14 +5,10 @@ from uuid import uuid4 from io import BytesIO from twisted.internet.defer import gatherResults -from twisted.internet.defer import DeferredSemaphore from leap.soledad.client._db.blobs import SQLiteBlobBackend -semaphore = DeferredSemaphore(2) - - # # put # @@ -23,7 +19,7 @@ def put(backend, amount, data): blob_id = uuid4().hex fd = BytesIO(data) size = len(data) - d = semaphore.run(backend.put, blob_id, fd, size) + d = backend.put(blob_id, fd, size) deferreds.append(d) return gatherResults(deferreds) @@ -51,7 +47,7 @@ test_sqlite_blobs_backend_put_1000_10k = create_put_test(1000, 10 * 1000) # -# put +# get # @pytest.inlineCallbacks diff --git a/tests/benchmarks/test_blobs_upload_download.py b/tests/benchmarks/test_blobs_upload_download.py index 1ec524dc..4489842a 100644 --- a/tests/benchmarks/test_blobs_upload_download.py +++ b/tests/benchmarks/test_blobs_upload_download.py @@ -8,7 +8,6 @@ from io import BytesIO from twisted.internet.defer import gatherResults from twisted.internet.defer import returnValue -from twisted.internet.defer import DeferredSemaphore from leap.soledad.client._db.blobs import BlobDoc @@ -20,10 +19,6 @@ def payload(size): return base64.b64encode(payload_bytes)[:size] # remove b64 overhead -# used to limit the amount of concurrent accesses to the blob manager -semaphore = DeferredSemaphore(2) - - def reclaim_free_space(client): return client.blobmanager.local.dbpool.runQuery("VACUUM") @@ -38,8 +33,7 @@ def load_up_downloads(client, amount, data): ids = yield client.blobmanager.remote_list(namespace='payload') deferreds = [] for blob_id in ids: - d = semaphore.run( - client.blobmanager.delete, blob_id, namespace='payload') + d = client.blobmanager.delete(blob_id, namespace='payload') deferreds.append(d) yield gatherResults(deferreds) @@ -49,8 +43,7 @@ def load_up_downloads(client, amount, data): fd = BytesIO(data) doc = BlobDoc(fd, blob_id=uuid.uuid4().hex) size = sys.getsizeof(fd) - d = semaphore.run( - client.blobmanager.put, doc, size, namespace='payload') + d = client.blobmanager.put(doc, size, namespace='payload') deferreds.append(d) yield gatherResults(deferreds) @@ -59,8 +52,7 @@ def load_up_downloads(client, amount, data): def download_blobs(client, pending): deferreds = [] for item in pending: - d = semaphore.run( - client.blobmanager.get, item, namespace='payload') + d = client.blobmanager.get(item, namespace='payload') deferreds.append(d) yield gatherResults(deferreds) @@ -114,8 +106,7 @@ def load_up_uploads(client, amount, data): ids = yield client.blobmanager.remote_list(namespace='payload') deferreds = [] for blob_id in ids: - d = semaphore.run( - client.blobmanager.delete, blob_id, namespace='payload') + d = client.blobmanager.delete(blob_id, namespace='payload') deferreds.append(d) yield gatherResults(deferreds) @@ -127,8 +118,7 @@ def upload_blobs(client, amount, data): fd = BytesIO(data) doc = BlobDoc(fd, blob_id=uuid.uuid4().hex) size = sys.getsizeof(fd) - d = semaphore.run( - client.blobmanager.put, doc, size, namespace='payload') + d = client.blobmanager.put(doc, size, namespace='payload') deferreds.append(d) yield gatherResults(deferreds) |