summaryrefslogtreecommitdiff
path: root/testing/tests/conftest.py
diff options
context:
space:
mode:
authordrebs <drebs@leap.se>2017-07-27 17:12:04 -0300
committerVictor Shyba <victor1984@riseup.net>2017-09-11 16:24:30 -0300
commit99cffc7388d53f9aaf5b8890401ba8ddc5b29178 (patch)
treef98282d0818ebe048b49ffc0112a1843305497a2 /testing/tests/conftest.py
parent70aa789c94b0dcced535cee86243e2dd4113b28a (diff)
[benchmarks] add responsiveness test with watchdog
Diffstat (limited to 'testing/tests/conftest.py')
-rw-r--r--testing/tests/conftest.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/testing/tests/conftest.py b/testing/tests/conftest.py
index e9641eba..6ce97625 100644
--- a/testing/tests/conftest.py
+++ b/testing/tests/conftest.py
@@ -1,8 +1,10 @@
import glob
+import base64
import json
import os
import pytest
import re
+import random
import requests
import signal
import socket
@@ -331,3 +333,17 @@ if 'pytest_benchmark' in sys.modules:
"""
hostname = os.environ.get('HOST_HOSTNAME', socket.gethostname())
machine_info['host'] = hostname
+
+
+#
+# benchmark/responsiveness fixtures
+#
+
+@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