diff options
author | Victor Shyba <victor.shyba@gmail.com> | 2016-08-20 01:27:47 -0300 |
---|---|---|
committer | Victor Shyba <victor.shyba@gmail.com> | 2016-08-22 12:36:16 -0300 |
commit | 585d6b2461869594210639548549aa6be336e752 (patch) | |
tree | 009b19ad70caaae193abe59550eba3d6eb36774b /testing | |
parent | 062d781b734db60d0ae317eaf5b86c7d75abacd9 (diff) |
[test] adds test for SoledadCrypto
10k, 100k, 500k, 1m, 10m and 50m for encryption and decryption of a
whole document.
Diffstat (limited to 'testing')
-rw-r--r-- | testing/tests/perf/test_crypto.py | 48 | ||||
-rw-r--r-- | testing/tests/perf/test_encdecpool.py | 18 |
2 files changed, 57 insertions, 9 deletions
diff --git a/testing/tests/perf/test_crypto.py b/testing/tests/perf/test_crypto.py new file mode 100644 index 00000000..84c89a0d --- /dev/null +++ b/testing/tests/perf/test_crypto.py @@ -0,0 +1,48 @@ +import pytest +import json +from uuid import uuid4 +from leap.soledad.common.document import SoledadDocument + + +def create_doc_encryption(size): + @pytest.mark.benchmark(group="test_crypto_encrypt_doc") + def test_doc_encryption(soledad_client, benchmark): + crypto = soledad_client()._crypto + + DOC_CONTENT = {'payload': 'x'*size} + doc = SoledadDocument( + doc_id=uuid4().hex, rev='rev', + json=json.dumps(DOC_CONTENT)) + + benchmark(crypto.encrypt_doc, doc) + return test_doc_encryption + + +def create_doc_decryption(size): + @pytest.mark.benchmark(group="test_crypto_decrypt_doc") + def test_doc_decryption(soledad_client, benchmark): + crypto = soledad_client()._crypto + + DOC_CONTENT = {'payload': 'x'*size} + doc = SoledadDocument( + doc_id=uuid4().hex, rev='rev', + json=json.dumps(DOC_CONTENT)) + encrypted_doc = crypto.encrypt_doc(doc) + doc.set_json(encrypted_doc) + + benchmark(crypto.decrypt_doc, doc) + return test_doc_decryption + + +test_encrypt_doc_10k = create_doc_encryption(10*1000) +test_encrypt_doc_100k = create_doc_encryption(100*1000) +test_encrypt_doc_500k = create_doc_encryption(500*1000) +test_encrypt_doc_1M = create_doc_encryption(1000*1000) +test_encrypt_doc_10M = create_doc_encryption(10*1000*1000) +test_encrypt_doc_50M = create_doc_encryption(50*1000*1000) +test_decrypt_doc_10k = create_doc_decryption(10*1000) +test_decrypt_doc_100k = create_doc_decryption(100*1000) +test_decrypt_doc_500k = create_doc_decryption(500*1000) +test_decrypt_doc_1M = create_doc_decryption(1000*1000) +test_decrypt_doc_10M = create_doc_decryption(10*1000*1000) +test_decrypt_doc_50M = create_doc_decryption(50*1000*1000) diff --git a/testing/tests/perf/test_encdecpool.py b/testing/tests/perf/test_encdecpool.py index dbbbea89..abc58e35 100644 --- a/testing/tests/perf/test_encdecpool.py +++ b/testing/tests/perf/test_encdecpool.py @@ -35,10 +35,10 @@ def create_encrypt(amount, size): yield txbenchmark_with_setup(setup, put_and_wait) return test -test_encrypt_1000_10k = create_encrypt(1000, 10*1000) -# test_encrypt_1000_500k = create_encrypt(1000, 500*1000) -# test_encrypt_1000_1M = create_encrypt(1000, 1000*1000) -# test_encrypt_1000_10M = create_encrypt(1000, 10*1000*1000) +test_encdecpool_encrypt_1000_10k = create_encrypt(1000, 10*1000) +# test_encdecpool_encrypt_1000_500k = create_encrypt(1000, 500*1000) +# test_encdecpool_encrypt_1000_1M = create_encrypt(1000, 1000*1000) +# test_encdecpool_encrypt_1000_10M = create_encrypt(1000, 10*1000*1000) def create_decrypt(amount, size): @@ -76,9 +76,9 @@ def create_decrypt(amount, size): yield txbenchmark_with_setup(setup, put_and_wait) return test -test_decrypt_1000_10k = create_decrypt(1000, 10*1000) -test_decrypt_1000_100k = create_decrypt(1000, 10*1000) +test_encdecpool_decrypt_1000_10k = create_decrypt(1000, 10*1000) +test_encdecpool_decrypt_1000_100k = create_decrypt(1000, 10*1000) # memory issues ahead -# test_decrypt_1000_500k = create_decrypt(1000, 500*1000) -# test_decrypt_1000_1M = create_decrypt(1000, 1000*1000) -# test_decrypt_1000_10M = create_decrypt(1000, 10*1000*1000) +# test_encdecpool_decrypt_1000_500k = create_decrypt(1000, 500*1000) +# test_encdecpool_decrypt_1000_1M = create_decrypt(1000, 1000*1000) +# test_encdecpool_decrypt_1000_10M = create_decrypt(1000, 10*1000*1000) |