summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeo wang <grakiss.wanglei@huawei.com>2017-09-28 07:36:57 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-09-28 07:36:57 +0000
commit465f738554c1c401707036a055577b35f7c06dca (patch)
tree4aa49e53170649fefc6bdaf39cfbf7847057a138
parent63c2e2aa4b8d86349a767f611123ceafc19fa6d6 (diff)
parent98ff39a0bb75e2ae07b4af77ddb127ffaeb4ce5b (diff)
Merge "Make Yardstick log level can be set by CLI"
-rw-r--r--dovetail/conf/yardstick_config.yml2
-rw-r--r--dovetail/container.py13
-rw-r--r--dovetail/patch/0001-Adjust-Yardstick-HA-test-cases-SLA-and-log-level.patch (renamed from dovetail/patch/0001-Adjust-Yardstick-HA-test-cases-SLA.patch)26
-rw-r--r--dovetail/report.py2
-rwxr-xr-xdovetail/run.py9
5 files changed, 38 insertions, 14 deletions
diff --git a/dovetail/conf/yardstick_config.yml b/dovetail/conf/yardstick_config.yml
index f49d044d..fea8cea7 100644
--- a/dovetail/conf/yardstick_config.yml
+++ b/dovetail/conf/yardstick_config.yml
@@ -20,7 +20,7 @@ yardstick:
cmds:
- 'mkdir -p /home/opnfv/yardstick/results/'
- "cd /home/opnfv/repos/yardstick && source tests/ci/prepare_env.sh &&
- yardstick -d task start tests/opnfv/test_cases/{{validate_testcase}}.yaml
+ yardstick task start tests/opnfv/test_cases/{{validate_testcase}}.yaml
--output-file /home/opnfv/yardstick/results/{{testcase}}.out
--task-args '{'file': '/home/opnfv/userconfig/pre_config/pod.yaml'}'"
post_condition:
diff --git a/dovetail/container.py b/dovetail/container.py
index 14045165..ff92fa4a 100644
--- a/dovetail/container.py
+++ b/dovetail/container.py
@@ -149,14 +149,19 @@ class Container(object):
# CI_DEBUG is used for showing the debug logs of the upstream projects
# BUILD_TAG is the unique id for this test
- envs = ' -e CI_DEBUG=true -e NODE_NAME=master'
+ envs = ' -e NODE_NAME=master'
+ DEBUG = os.getenv('DEBUG')
+ if DEBUG is not None and DEBUG.lower() == "true":
+ envs = envs + ' -e CI_DEBUG=true'
+ else:
+ envs = envs + ' -e CI_DEBUG=false'
envs = envs + ' -e BUILD_TAG=%s-%s' % (dovetail_config['build_tag'],
testcase_name)
hosts_config = ""
hosts_config_file = os.path.join(dovetail_config['config_dir'],
'hosts.yaml')
- try:
+ if os.path.isfile(hosts_config_file):
with open(hosts_config_file) as f:
hosts_info = yaml.safe_load(f)
if hosts_info['hosts_info']:
@@ -165,10 +170,6 @@ class Container(object):
hosts_config += " --add-host "
hosts_config += str(host)
cls.logger.debug('Get hosts info {}.'.format(host))
- except Exception:
- cls.logger.warn('Failed to get hosts info in {}, '
- 'maybe some issues with domain name resolution.'
- .format(hosts_config_file))
config = ""
if type.lower() == "functest":
diff --git a/dovetail/patch/0001-Adjust-Yardstick-HA-test-cases-SLA.patch b/dovetail/patch/0001-Adjust-Yardstick-HA-test-cases-SLA-and-log-level.patch
index 92c68032..8c9589ca 100644
--- a/dovetail/patch/0001-Adjust-Yardstick-HA-test-cases-SLA.patch
+++ b/dovetail/patch/0001-Adjust-Yardstick-HA-test-cases-SLA-and-log-level.patch
@@ -1,7 +1,7 @@
-From 3beb6cdffa830f009d246e6352efa7ccf70463a0 Mon Sep 17 00:00:00 2001
-From: Jing Lu <hanazawarei@icloud.com>
-Date: Sat, 26 Aug 2017 10:07:52 +0800
-Subject: [PATCH] Adjust Yardstick HA test cases SLA
+From b7c13b5a7e07abdf4d3631049625461271fa5c5b Mon Sep 17 00:00:00 2001
+From: cvp <cvp@example.com>
+Date: Tue, 26 Sep 2017 03:59:54 +0000
+Subject: [PATCH] Adjust Yardstick HA test cases SLA and log level
---
tests/opnfv/test_cases/opnfv_yardstick_tc019.yaml | 4 ++--
@@ -10,7 +10,8 @@ Subject: [PATCH] Adjust Yardstick HA test cases SLA
tests/opnfv/test_cases/opnfv_yardstick_tc047.yaml | 4 ++--
tests/opnfv/test_cases/opnfv_yardstick_tc048.yaml | 4 ++--
tests/opnfv/test_cases/opnfv_yardstick_tc053.yaml | 4 ++--
- 6 files changed, 12 insertions(+), 12 deletions(-)
+ yardstick/__init__.py | 2 +-
+ 7 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/tests/opnfv/test_cases/opnfv_yardstick_tc019.yaml b/tests/opnfv/test_cases/opnfv_yardstick_tc019.yaml
index 5d3057d..c1d3645 100644
@@ -114,6 +115,19 @@ index 9e05cc8..e3f0934 100644
-
monitor_type: "openstack-cmd"
+diff --git a/yardstick/__init__.py b/yardstick/__init__.py
+index 2f5ae9f..973bfa2 100644
+--- a/yardstick/__init__.py
++++ b/yardstick/__init__.py
+@@ -44,7 +44,7 @@ def _init_logging():
+ _LOG_STREAM_HDLR.setLevel(logging.INFO)
+ # don't append to log file, clobber
+ _LOG_FILE_HDLR.setFormatter(_LOG_FORMATTER)
+- _LOG_FILE_HDLR.setLevel(logging.DEBUG)
++ _LOG_FILE_HDLR.setLevel(logging.INFO)
+
+ del logging.root.handlers[:]
+ logging.root.addHandler(_LOG_STREAM_HDLR)
--
-2.13.1 (Apple Git-89)
+1.9.1
diff --git a/dovetail/report.py b/dovetail/report.py
index 995b332d..535e5a25 100644
--- a/dovetail/report.py
+++ b/dovetail/report.py
@@ -80,7 +80,7 @@ class Report(object):
'result': testcase.sub_testcase_passed(sub_test)
})
report_obj['testcases_list'].append(testcase_inreport)
- cls.logger.info(json.dumps(report_obj))
+ cls.logger.debug(json.dumps(report_obj))
return report_obj
@classmethod
diff --git a/dovetail/run.py b/dovetail/run.py
index 1133b864..c7496475 100755
--- a/dovetail/run.py
+++ b/dovetail/run.py
@@ -239,6 +239,14 @@ def env_init(logger):
dt_utils.source_env(openrc)
+def check_hosts_file(logger):
+ hosts_file = os.path.join(dt_cfg.dovetail_config['config_dir'],
+ 'hosts.yaml')
+ if not os.path.isfile(hosts_file):
+ logger.warn("There is no hosts file {}, may be some issues with "
+ "domain name resolution.".format(hosts_file))
+
+
def main(*args, **kwargs):
"""Dovetail compliance test entry!"""
build_tag = "daily-master-%s" % str(uuid.uuid1())
@@ -259,6 +267,7 @@ def main(*args, **kwargs):
copy_patch_files(logger)
dt_utils.check_docker_version(logger)
validate_input(kwargs, dt_cfg.dovetail_config['validate_input'], logger)
+ check_hosts_file(logger)
configs = filter_config(kwargs, logger)
if configs is not None: