summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xscripts/docker/files/bin/run-perf.sh4
-rw-r--r--testing/tests/perf/conftest.py6
-rw-r--r--testing/tests/perf/test_sync.py4
3 files changed, 11 insertions, 3 deletions
diff --git a/scripts/docker/files/bin/run-perf.sh b/scripts/docker/files/bin/run-perf.sh
index 35c7f006..72060230 100755
--- a/scripts/docker/files/bin/run-perf.sh
+++ b/scripts/docker/files/bin/run-perf.sh
@@ -2,6 +2,7 @@
REPO=/builds/leap/soledad/testing
COUCH_URL="${COUCH_URL:-http://127.0.0.1:5984}"
+SOLEDAD_PRELOAD_NUM="${SOLEDAD_PRELOAD_NUM:-100}"
if [ ! -z "${SOLEDAD_REMOTE}" ]; then
git -C ${REPO} remote set-url origin ${SOLEDAD_REMOTE}
@@ -17,4 +18,5 @@ cd ${REPO}
tox perf -- \
--durations 0 \
--couch-url ${COUCH_URL} \
- --twisted
+ --twisted \
+ --num-docs ${SOLEDAD_PRELOAD_NUM}
diff --git a/testing/tests/perf/conftest.py b/testing/tests/perf/conftest.py
index 85a48059..463c791a 100644
--- a/testing/tests/perf/conftest.py
+++ b/testing/tests/perf/conftest.py
@@ -26,6 +26,12 @@ def pytest_addoption(parser):
help="the url for the couch server to be used during tests")
+def pytest_addoption(parser):
+ parser.addoption(
+ "--num-docs", type="int", default=100,
+ help="the number of documents to use in performance tests")
+
+
#
# default options for all tests
#
diff --git a/testing/tests/perf/test_sync.py b/testing/tests/perf/test_sync.py
index 9de733fb..45af9a91 100644
--- a/testing/tests/perf/test_sync.py
+++ b/testing/tests/perf/test_sync.py
@@ -12,7 +12,7 @@ content = ' ' * 10000
@pytest.inlineCallbacks
def test_upload(soledad_client, request):
# create a bunch of local documents
- uploads = 100
+ uploads = request.config.option.num_docs
deferreds = []
for i in xrange(uploads):
d = soledad_client.create_doc({'upload': True, 'content': content})
@@ -32,7 +32,7 @@ def test_upload(soledad_client, request):
@pytest.inlineCallbacks
def test_download(soledad_client, request):
# create a bunch of remote documents
- downloads = 100
+ downloads = request.config.option.num_docs
url = request.config.getoption('--couch-url')
remote = CouchDatabase(url, 'user-0')
for i in xrange(downloads):