From d86831e4cd3e77f340618168528e62cf4dafb5d7 Mon Sep 17 00:00:00 2001 From: Victor Shyba Date: Mon, 29 Aug 2016 00:05:45 -0300 Subject: [test] randomize payload We were using 'x'*size as payload, but on real usage the payload will be random. This commit randomizes the payload using a predefined seed, so the random payload will be the same across benchmarks. Using random payloads also improves accuracy of compression or encoding impacts and we will be evaluating those changes for resouce usage issues. Also note that base64 is used on payload. That was needed for utf8 safety, but overhead was removed to leave payloads as defined by benchmarks. Base64 was chosen also due its popular usage on MIME encoding, which is used on mail attachments (our current scenario). --- testing/tests/perf/test_encdecpool.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'testing/tests/perf/test_encdecpool.py') diff --git a/testing/tests/perf/test_encdecpool.py b/testing/tests/perf/test_encdecpool.py index 3c501084..77091a41 100644 --- a/testing/tests/perf/test_encdecpool.py +++ b/testing/tests/perf/test_encdecpool.py @@ -11,8 +11,8 @@ from leap.soledad.common.document import SoledadDocument def create_encrypt(amount, size): @pytest.mark.benchmark(group="test_pool_encrypt") @pytest.inlineCallbacks - def test(soledad_client, txbenchmark_with_setup, request): - DOC_CONTENT = {'payload': 'x'*size} + def test(soledad_client, txbenchmark_with_setup, request, payload): + DOC_CONTENT = {'payload': payload(size)} def setup(): client = soledad_client() @@ -41,8 +41,8 @@ test_encdecpool_encrypt_100_500k = create_encrypt(100, 500*1000) def create_decrypt(amount, size): @pytest.mark.benchmark(group="test_pool_decrypt") @pytest.inlineCallbacks - def test(soledad_client, txbenchmark_with_setup, request): - DOC_CONTENT = {'payload': 'x'*size} + def test(soledad_client, txbenchmark_with_setup, request, payload): + DOC_CONTENT = {'payload': payload(size)} client = soledad_client() def setup(): -- cgit v1.2.3