summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJing Lu <lvjing5@huawei.com>2017-05-04 02:21:03 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-05-04 02:21:03 +0000
commit1c3517df20afa4b55af13bcc4ae16bc9534dc618 (patch)
tree69ee51947b39af611b10a30519e1ed3fe487e7e5
parent057a75ffb04deb5bf7baf858990b125c525e58f7 (diff)
parent8c53f0c78b72bdcf4511ae65501ab111a2d194a6 (diff)
Merge "Bugfix: KeyError when using http dispatcher" into stable/danube
-rwxr-xr-xyardstick/benchmark/runners/base.py7
-rw-r--r--yardstick/dispatcher/http.py7
2 files changed, 10 insertions, 4 deletions
diff --git a/yardstick/benchmark/runners/base.py b/yardstick/benchmark/runners/base.py
index 7c76e42df..b48ed973a 100755
--- a/yardstick/benchmark/runners/base.py
+++ b/yardstick/benchmark/runners/base.py
@@ -22,6 +22,7 @@ import logging
import multiprocessing
import subprocess
import time
+import os
import traceback
from oslo_config import cfg
@@ -40,7 +41,11 @@ def _output_serializer_main(filename, queue, config):
Use of this process enables multiple instances of a scenario without
messing up the output file.
"""
- out_type = config['yardstick'].get('DEFAULT', {}).get('dispatcher', 'file')
+ try:
+ out_type = config['yardstick'].get('DEFAULT', {})['dispatcher']
+ except KeyError:
+ out_type = os.environ.get('DISPATCHER', 'file')
+
conf = {
'type': out_type.capitalize(),
'file_path': filename
diff --git a/yardstick/dispatcher/http.py b/yardstick/dispatcher/http.py
index e3bcbc89b..0d8d2a346 100644
--- a/yardstick/dispatcher/http.py
+++ b/yardstick/dispatcher/http.py
@@ -32,7 +32,7 @@ LOG = logging.getLogger(__name__)
CONF = cfg.CONF
http_dispatcher_opts = [
cfg.StrOpt('target',
- default='http://127.0.0.1:8000/results',
+ default=os.getenv('TARGET', 'http://127.0.0.1:8000/results'),
help='The target where the http request will be sent. '
'If this is not set, no data will be posted. For '
'example: target = http://hostname:1234/path'),
@@ -62,7 +62,8 @@ class HttpDispatcher(DispatchBase):
"description": "yardstick test cases result",
"pod_name": os.environ.get('NODE_NAME', 'unknown'),
"installer": os.environ.get('INSTALLER_TYPE', 'unknown'),
- "version": os.environ.get('YARDSTICK_VERSION', 'unknown')
+ "version": os.environ.get('YARDSTICK_VERSION', 'unknown'),
+ "build_tag": os.environ.get('BUILD_TAG')
}
def record_result_data(self, data):
@@ -75,7 +76,7 @@ class HttpDispatcher(DispatchBase):
'be posted.')
return
- self.result["details"] = self.raw_result
+ self.result["details"] = {'results': self.raw_result}
case_name = ""
for v in self.raw_result: