summaryrefslogtreecommitdiffstats
path: root/dovetail
diff options
context:
space:
mode:
authorhongbo tian <hongbo.tianhongbo@huawei.com>2017-01-14 01:52:26 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-01-14 01:52:26 +0000
commit0559cd7924467392659716115936c4ae1312a513 (patch)
tree61af6673adab587a34e92d99e088fc84730e28b9 /dovetail
parent60f1f328b2ebc94330dcbf5f4374684a410d3e92 (diff)
parent3114be6f8c77962e27551645af1859c51a110600 (diff)
Merge "dovetail tool: switch logging to proper usage"
Diffstat (limited to 'dovetail')
-rw-r--r--dovetail/parser.py8
-rw-r--r--dovetail/report.py28
-rwxr-xr-xdovetail/run.py14
-rw-r--r--dovetail/test_runner.py2
4 files changed, 26 insertions, 26 deletions
diff --git a/dovetail/parser.py b/dovetail/parser.py
index b00b0f89..74a57764 100644
--- a/dovetail/parser.py
+++ b/dovetail/parser.py
@@ -32,15 +32,15 @@ class Parser:
kwargs = {}
for arg in dt_cfg.dovetail_config['parameters']:
path = eval(arg['path'])
- cls.logger.debug('name: %s, eval path: %s ' %
- (arg['name'], path))
+ cls.logger.debug('name: %s, eval path: %s ',
+ arg['name'], path)
kwargs[arg['name']] = \
dt_utils.get_obj_by_path(testcase.testcase, path)
- cls.logger.debug('kwargs: %s' % kwargs)
+ cls.logger.debug('kwargs: %s', kwargs)
cmd_lines = template.render(**kwargs)
except Exception as e:
- cls.logger.error('failed to parse cmd %s, exception:%s' % (cmd, e))
+ cls.logger.error('failed to parse cmd %s, exception:%s', cmd, e)
return None
return cmd_lines
diff --git a/dovetail/report.py b/dovetail/report.py
index 5da6ef87..91a4ebd4 100644
--- a/dovetail/report.py
+++ b/dovetail/report.py
@@ -160,9 +160,9 @@ class Report:
with open(os.path.join(dt_cfg.dovetail_config['result_dir'],
report_file_name), 'w') as report_file:
report_file.write(report)
- cls.logger.info('save report to %s' % report_file_name)
+ cls.logger.info('save report to %s', report_file_name)
except Exception:
- cls.logger.error('Failed to save: %s' % report_file_name)
+ cls.logger.error('Failed to save: %s', report_file_name)
@classmethod
def get_result(cls, testcase):
@@ -181,12 +181,12 @@ class Report:
if result is not None:
cls.results[type][validate_testcase] = result
testcase.script_result_acquired(True)
- cls.logger.debug('testcase: %s -> result acquired' %
+ cls.logger.debug('testcase: %s -> result acquired',
validate_testcase)
else:
retry = testcase.increase_retry()
- cls.logger.debug('testcase: %s -> result acquired retry:%d' %
- (validate_testcase, retry))
+ cls.logger.debug('testcase: %s -> result acquired retry:%d',
+ validate_testcase, retry)
return result
@@ -218,7 +218,7 @@ class FunctestCrawler:
os.path.join(dovetail_config['result_dir'],
dovetail_config[self.type]['result']['file_path'])
if not os.path.exists(file_path):
- self.logger.info('result file not found: %s' % file_path)
+ self.logger.info('result file not found: %s', file_path)
return None
try:
@@ -240,24 +240,24 @@ class FunctestCrawler:
"duration": int(dur_sec_int),
"tests": int(num_tests), "failures": failed_num,
"errors": error_logs}}
- self.logger.debug('Results: %s' % str(json_results))
+ self.logger.debug('Results: %s', str(json_results))
return json_results
except Exception as e:
self.logger.error('Cannot read content from the file: %s, '
- 'exception: %s' % (file_path, e))
+ 'exception: %s', file_path, e)
return None
def crawl_from_url(self, testcase=None):
url = \
dt_cfg.dovetail_config[self.type]['result']['db_url'] % \
testcase.validate_testcase()
- self.logger.debug("Query to rest api: %s" % url)
+ self.logger.debug("Query to rest api: %s", url)
try:
data = json.load(urllib2.urlopen(url))
return data['results'][0]
except Exception as e:
self.logger.error("Cannot read content from the url: %s, "
- "exception: %s" % (url, e))
+ "exception: %s", url, e)
return None
@@ -287,18 +287,18 @@ class YardstickCrawler:
file_path = os.path.join(dt_cfg.dovetail_config['result_dir'],
testcase.validate_testcase() + '.out')
if not os.path.exists(file_path):
- self.logger.info('result file not found: %s' % file_path)
+ self.logger.info('result file not found: %s', file_path)
return None
try:
with open(file_path, 'r') as myfile:
myfile.read()
criteria = 'PASS'
json_results = {'criteria': criteria}
- self.logger.debug('Results: %s' % str(json_results))
+ self.logger.debug('Results: %s', str(json_results))
return json_results
except Exception as e:
self.logger.error('Cannot read content from the file: %s, '
- 'exception: %s' % (file_path, e))
+ 'exception: %s', file_path, e)
return None
def crawl_from_url(self, testcase=None):
@@ -377,7 +377,7 @@ class FunctestChecker:
all_passed = True
for sub_testcase in sub_testcase_list:
- self.logger.debug('check sub_testcase:%s' % sub_testcase)
+ self.logger.debug('check sub_testcase:%s', sub_testcase)
if sub_testcase in db_result['details']['errors']:
testcase.sub_testcase_passed(sub_testcase, False)
all_passed = False
diff --git a/dovetail/run.py b/dovetail/run.py
index 85e65667..1fb0a89a 100755
--- a/dovetail/run.py
+++ b/dovetail/run.py
@@ -44,11 +44,11 @@ def run_test(testsuite, testarea, logger):
duration = 0
for testcase_name in testarea_list:
- logger.info('>>[testcase]: %s' % (testcase_name))
+ logger.info('>>[testcase]: %s', testcase_name)
testcase = Testcase.get(testcase_name)
if testcase is None:
logger.error('test case %s is not defined in testcase folder, \
- skipping' % (testcase_name))
+ skipping', testcase_name)
continue
run_testcase = True
@@ -155,16 +155,16 @@ def main(*args, **kwargs):
create_logs()
logger = dt_logger.Logger('run').getLogger()
logger.info('================================================')
- logger.info('Dovetail compliance: %s!' % (kwargs['testsuite']))
+ logger.info('Dovetail compliance: %s!', (kwargs['testsuite']))
logger.info('================================================')
validate_input(kwargs, dt_cfg.dovetail_config['validate_input'], logger)
configs = filter_config(kwargs, logger)
if configs is not None:
dt_cfg.update_config(configs)
- logger.info('Your new envs for functest: %s' %
+ logger.info('Your new envs for functest: %s',
dt_cfg.dovetail_config['functest']['envs'])
- logger.info('Your new envs for yardstick: %s' %
+ logger.info('Your new envs for yardstick: %s',
dt_cfg.dovetail_config['yardstick']['envs'])
testarea = kwargs['testarea']
@@ -181,8 +181,8 @@ def main(*args, **kwargs):
duration = run_test(testsuite_yaml, testarea, logger)
Report.generate(testsuite_yaml, testarea, duration)
else:
- logger.error('invalid input commands, testsuite %s testarea %s' %
- (kwargs['testsuite'], testarea))
+ logger.error('invalid input commands, testsuite %s testarea %s',
+ kwargs['testsuite'], testarea)
dt_cfg.load_config_files()
diff --git a/dovetail/test_runner.py b/dovetail/test_runner.py
index 8315380a..29217f5f 100644
--- a/dovetail/test_runner.py
+++ b/dovetail/test_runner.py
@@ -35,7 +35,7 @@ class DockerRunner(object):
self.logger.error('failed to create container')
return
- self.logger.debug('container id:%s' % container_id)
+ self.logger.debug('container id:%s', container_id)
if not self.testcase.prepared():
failed = False