summaryrefslogtreecommitdiff
path: root/testing/tests/responsiveness
diff options
context:
space:
mode:
authordrebs <drebs@riseup.net>2017-09-11 15:06:11 -0300
committerVictor Shyba <victor1984@riseup.net>2017-09-11 16:24:30 -0300
commit993f5ca6aa936db632dd5e014bb6b4302cbd3ed8 (patch)
treeb7724f659d1b5061e8ee0361ebbdd1a66027216c /testing/tests/responsiveness
parent89dd40d77fbd602a415e5ae673d4166e1b432428 (diff)
[test] print responsiveness results if no elastic url is given
Diffstat (limited to 'testing/tests/responsiveness')
-rw-r--r--testing/tests/responsiveness/conftest.py5
-rw-r--r--testing/tests/responsiveness/elastic.py25
2 files changed, 13 insertions, 17 deletions
diff --git a/testing/tests/responsiveness/conftest.py b/testing/tests/responsiveness/conftest.py
index 0aaaa32b..a46aea44 100644
--- a/testing/tests/responsiveness/conftest.py
+++ b/testing/tests/responsiveness/conftest.py
@@ -18,8 +18,3 @@ def watchdog(request):
deferred_fun().addCallback(lambda _: dog.stop())
return dog_d
return _run
-
-
-def pytest_configure(config):
- option = config.getoption("elasticsearch_url", elastic.ELASTICSEARCH_URL)
- elastic.ELASTICSEARCH_URL = option
diff --git a/testing/tests/responsiveness/elastic.py b/testing/tests/responsiveness/elastic.py
index 50bae0b3..fed1506b 100644
--- a/testing/tests/responsiveness/elastic.py
+++ b/testing/tests/responsiveness/elastic.py
@@ -6,19 +6,20 @@ from pytest_benchmark.utils import get_commit_info, get_tag, get_machine_id
from pytest_benchmark.storage.elasticsearch import BenchmarkJSONSerializer
-ELASTICSEARCH_URL = 'http://elastic:changeme@127.0.0.1:9200/'
-
-
-def post(seconds_blocked, request):
- es = elasticsearch.Elasticsearch(
- hosts=[ELASTICSEARCH_URL],
- serializer=BenchmarkJSONSerializer())
+def post(seconds_blocked, request,):
body, doc_id = get_doc(seconds_blocked, request)
- es.index(
- index='responsiveness',
- doc_type='responsiveness',
- id=doc_id,
- body=body)
+ url = request.config.getoption("elasticsearch_url")
+ if url:
+ es = elasticsearch.Elasticsearch(
+ hosts=[url],
+ serializer=BenchmarkJSONSerializer())
+ es.index(
+ index='responsiveness',
+ doc_type='responsiveness',
+ id=doc_id,
+ body=body)
+ else:
+ print body
def get_doc(seconds_blocked, request):