summaryrefslogtreecommitdiff
path: root/testing
diff options
context:
space:
mode:
authordrebs <drebs@leap.se>2017-07-17 20:37:19 -0300
committerdrebs <drebs@leap.se>2017-07-18 13:51:09 -0300
commit49484d93ba4183af460e592bb163153a92ba8571 (patch)
tree8987a6fbe513f249f078b09afbc6964660639a97 /testing
parent465737c82439fd4fa32c4a89c5e84b1bca7fc4d7 (diff)
[benchmarks] add docstrings for benchmarks
Diffstat (limited to 'testing')
-rw-r--r--testing/tests/benchmarks/conftest.py4
-rw-r--r--testing/tests/benchmarks/test_crypto.py12
-rw-r--r--testing/tests/benchmarks/test_misc.py3
-rw-r--r--testing/tests/benchmarks/test_sqlcipher.py6
-rw-r--r--testing/tests/benchmarks/test_sync.py9
5 files changed, 32 insertions, 2 deletions
diff --git a/testing/tests/benchmarks/conftest.py b/testing/tests/benchmarks/conftest.py
index 8a82b012..25fe5134 100644
--- a/testing/tests/benchmarks/conftest.py
+++ b/testing/tests/benchmarks/conftest.py
@@ -144,8 +144,8 @@ def _monitored_benchmark(benchmark_fixture, benchmark_function, request,
# add docstring info
if request.scope == 'function':
fun = request.function
- doc = fun.__doc__
- benchmark_fixture.extra_info.update({'doc': doc or ''})
+ doc = fun.__doc__ or ''
+ benchmark_fixture.extra_info.update({'doc': doc.strip()})
def _watch_memory(request):
diff --git a/testing/tests/benchmarks/test_crypto.py b/testing/tests/benchmarks/test_crypto.py
index a53e1783..3be447a5 100644
--- a/testing/tests/benchmarks/test_crypto.py
+++ b/testing/tests/benchmarks/test_crypto.py
@@ -22,6 +22,9 @@ def create_doc_encryption(size):
@pytest.mark.benchmark(group="test_crypto_encrypt_doc")
@pytest.inlineCallbacks
def test_doc_encryption(soledad_client, txbenchmark, payload):
+ """
+ Encrypt a document of a given size.
+ """
crypto = soledad_client()._crypto
DOC_CONTENT = {'payload': payload(size)}
@@ -40,6 +43,9 @@ def create_doc_decryption(size):
@pytest.inlineCallbacks
@pytest.mark.benchmark(group="test_crypto_decrypt_doc")
def test_doc_decryption(soledad_client, txbenchmark, payload):
+ """
+ Decrypt a document of a given size.
+ """
crypto = soledad_client()._crypto
DOC_CONTENT = {'payload': payload(size)}
@@ -57,6 +63,9 @@ def create_doc_decryption(size):
def create_raw_encryption(size):
@pytest.mark.benchmark(group="test_crypto_raw_encrypt")
def test_raw_encrypt(monitored_benchmark, payload):
+ """
+ Encrypt raw payload using default mode from crypto module.
+ """
key = payload(32)
monitored_benchmark(_crypto.encrypt_sym, payload(size), key)
return test_raw_encrypt
@@ -65,6 +74,9 @@ def create_raw_encryption(size):
def create_raw_decryption(size):
@pytest.mark.benchmark(group="test_crypto_raw_decrypt")
def test_raw_decrypt(monitored_benchmark, payload):
+ """
+ Decrypt raw payload using default mode from crypto module.
+ """
key = payload(32)
iv, ciphertext = _crypto.encrypt_sym(payload(size), key)
monitored_benchmark(_crypto.decrypt_sym, ciphertext, key, iv)
diff --git a/testing/tests/benchmarks/test_misc.py b/testing/tests/benchmarks/test_misc.py
index 4a7412a5..8b2178b9 100644
--- a/testing/tests/benchmarks/test_misc.py
+++ b/testing/tests/benchmarks/test_misc.py
@@ -3,4 +3,7 @@ import pytest
@pytest.mark.benchmark(group="test_instance")
def test_initialization(soledad_client, monitored_benchmark):
+ """
+ Soledad client object initialization.
+ """
monitored_benchmark(soledad_client)
diff --git a/testing/tests/benchmarks/test_sqlcipher.py b/testing/tests/benchmarks/test_sqlcipher.py
index 9dd21bea..9108084c 100644
--- a/testing/tests/benchmarks/test_sqlcipher.py
+++ b/testing/tests/benchmarks/test_sqlcipher.py
@@ -16,6 +16,9 @@ def build_test_sqlcipher_async_create(amount, size):
@pytest.inlineCallbacks
@pytest.mark.benchmark(group="test_sqlcipher_async_create")
def test(soledad_client, txbenchmark_with_setup, payload):
+ """
+ Create many documents of a given size concurrently.
+ """
client = soledad_client()
yield txbenchmark_with_setup(
lambda: None, load_up, client, amount, payload(size))
@@ -26,6 +29,9 @@ def build_test_sqlcipher_create(amount, size):
@pytest.mark.skip(reason="this test is lengthy and not a real use case")
@pytest.mark.benchmark(group="test_sqlcipher_create")
def test(soledad_client, monitored_benchmark, payload):
+ """
+ Create many documents of a given size serially.
+ """
client = soledad_client()._dbsyncer
monitored_benchmark(
load_up, client, amount, payload(size), defer=False)
diff --git a/testing/tests/benchmarks/test_sync.py b/testing/tests/benchmarks/test_sync.py
index 4a275040..45506d77 100644
--- a/testing/tests/benchmarks/test_sync.py
+++ b/testing/tests/benchmarks/test_sync.py
@@ -21,6 +21,9 @@ def create_upload(uploads, size):
@pytest.inlineCallbacks
@pytest.mark.benchmark(group="test_upload")
def test(soledad_client, txbenchmark_with_setup, payload):
+ """
+ Upload many documents of a given size.
+ """
client = soledad_client()
def setup():
@@ -49,6 +52,9 @@ def create_download(downloads, size):
@pytest.inlineCallbacks
@pytest.mark.benchmark(group="test_download")
def test(soledad_client, txbenchmark_with_setup, payload):
+ """
+ Download many documents of the same size.
+ """
client = soledad_client()
yield load_up(client, downloads, payload(size))
@@ -75,6 +81,9 @@ test_download_1000_10k = create_download(1000, 10 * 1000)
@pytest.inlineCallbacks
@pytest.mark.benchmark(group="test_nothing_to_sync")
def test_nothing_to_sync(soledad_client, txbenchmark_with_setup):
+ """
+ Sync two replicas that are already in sync.
+ """
def setup():
return soledad_client()