From 993f5ca6aa936db632dd5e014bb6b4302cbd3ed8 Mon Sep 17 00:00:00 2001 From: drebs Date: Mon, 11 Sep 2017 15:06:11 -0300 Subject: [test] print responsiveness results if no elastic url is given --- testing/tests/responsiveness/conftest.py | 5 ----- testing/tests/responsiveness/elastic.py | 25 +++++++++++++------------ 2 files changed, 13 insertions(+), 17 deletions(-) (limited to 'testing/tests') 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): -- cgit v1.2.3