summaryrefslogtreecommitdiff
path: root/testing/tests/perf/conftest.py
diff options
context:
space:
mode:
Diffstat (limited to 'testing/tests/perf/conftest.py')
-rw-r--r--testing/tests/perf/conftest.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/testing/tests/perf/conftest.py b/testing/tests/perf/conftest.py
index 9abd0c54..3681025f 100644
--- a/testing/tests/perf/conftest.py
+++ b/testing/tests/perf/conftest.py
@@ -2,6 +2,8 @@ import json
import os
import pytest
import requests
+import random
+import base64
import signal
import time
@@ -43,6 +45,16 @@ DEFAULT_CERTKEY = 'soledad_certkey.pem'
DEFAULT_TOKEN = 'an-auth-token'
+@pytest.fixture()
+def payload():
+ def generate(size):
+ random.seed(1337) # same seed to avoid different bench results
+ payload_bytes = bytearray(random.getrandbits(8) for _ in xrange(size))
+ # encode as base64 to avoid ascii encode/decode errors
+ return base64.b64encode(payload_bytes)[:size] # remove b64 overhead
+ return generate
+
+
#
# soledad_dbs fixture: provides all databases needed by soledad server in a per
# module scope (same databases for all tests in this module).