summaryrefslogtreecommitdiff
path: root/testing/tests/perf/test_sync.py
diff options
context:
space:
mode:
Diffstat (limited to 'testing/tests/perf/test_sync.py')
-rw-r--r--testing/tests/perf/test_sync.py104
1 files changed, 31 insertions, 73 deletions
diff --git a/testing/tests/perf/test_sync.py b/testing/tests/perf/test_sync.py
index ea109d05..146f1394 100644
--- a/testing/tests/perf/test_sync.py
+++ b/testing/tests/perf/test_sync.py
@@ -15,87 +15,45 @@ def load_up(client, amount, size):
return d
-@pytest.inlineCallbacks
-@pytest.mark.benchmark(group="test_upload")
-def test_upload_20_500k(soledad_client, txbenchmark_with_setup):
- uploads, size, client = 20, 500*1000, soledad_client()
+def create_upload(uploads, size):
+ @pytest.inlineCallbacks
+ @pytest.mark.benchmark(group="test_upload")
+ def test(soledad_client, txbenchmark_with_setup):
+ client = soledad_client()
- def setup():
- return load_up(client, uploads, size)
+ def setup():
+ return load_up(client, uploads, size)
- yield txbenchmark_with_setup(setup, client.sync)
+ yield txbenchmark_with_setup(setup, client.sync)
+ return test
-@pytest.inlineCallbacks
-@pytest.mark.benchmark(group="test_upload")
-def test_upload_100_100k(soledad_client, txbenchmark_with_setup):
- uploads, size, client = 100, 100*1000, soledad_client()
+test_upload_20_500k = create_upload(20, 500*1000)
+test_upload_100_100k = create_upload(100, 100*1000)
+test_upload_1000_10k = create_upload(1000, 10*1000)
- def setup():
- return load_up(client, uploads, size)
- yield txbenchmark_with_setup(setup, client.sync)
+def create_download(downloads, size):
+ @pytest.inlineCallbacks
+ @pytest.mark.benchmark(group="test_download")
+ def test(soledad_client, txbenchmark_with_setup):
+ client = soledad_client()
+ yield load_up(client, downloads, size)
+ yield client.sync()
+ # We could create them directly on couch, but sending them
+ # ensures we are dealing with properly encrypted docs
-@pytest.inlineCallbacks
-@pytest.mark.benchmark(group="test_upload")
-def test_upload_1000_10k(soledad_client, txbenchmark_with_setup):
- uploads, size, client = 1000, 10*1000, soledad_client()
+ def setup():
+ clean_client = soledad_client()
+ return (clean_client,), {}
- def setup():
- return load_up(client, uploads, size)
+ def sync(clean_client):
+ return clean_client.sync()
+ yield txbenchmark_with_setup(setup, sync)
+ return test
- yield txbenchmark_with_setup(setup, client.sync)
-
-@pytest.inlineCallbacks
-@pytest.mark.benchmark(group="test_download")
-def test_download_20_500k(soledad_client, txbenchmark_with_setup):
- downloads, size, client = 20, 500*1000, soledad_client()
-
- yield load_up(client, downloads, size)
- yield client.sync()
-
- def setup():
- clean_client = soledad_client()
- return (clean_client,), {}
-
- def sync(clean_client):
- return clean_client.sync()
- yield txbenchmark_with_setup(setup, sync)
-
-
-@pytest.inlineCallbacks
-@pytest.mark.benchmark(group="test_download")
-def test_download_100_100k(soledad_client, txbenchmark_with_setup):
- downloads, size, client = 100, 100*1000, soledad_client()
-
- yield load_up(client, downloads, size)
- yield client.sync()
- # We could create them directly on remote db, but sending them
- # ensures we are dealing with properly encrypted docs
-
- def setup():
- clean_client = soledad_client()
- return (clean_client,), {}
-
- def sync(clean_client):
- return clean_client.sync()
- yield txbenchmark_with_setup(setup, sync)
-
-
-@pytest.inlineCallbacks
-@pytest.mark.benchmark(group="test_download")
-def test_download_1000_10k(soledad_client, txbenchmark_with_setup):
- downloads, size, client = 1000, 10*1000, soledad_client()
-
- yield load_up(client, downloads, size)
- yield client.sync()
-
- def setup():
- clean_client = soledad_client()
- return (clean_client,), {}
-
- def sync(clean_client):
- return clean_client.sync()
- yield txbenchmark_with_setup(setup, sync)
+test_download_20_500k = create_download(20, 500*1000)
+test_download_100_100k = create_download(100, 100*1000)
+test_download_1000_10k = create_download(1000, 10*1000)