summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--dovetail/compliance/debug.yml8
-rw-r--r--dovetail/conf/dovetail_config.yml4
-rw-r--r--dovetail/conf/functest_config.yml1
-rw-r--r--dovetail/container.py10
-rw-r--r--dovetail/report.py57
-rw-r--r--dovetail/test_runner.py7
-rw-r--r--dovetail/testcase.py11
-rw-r--r--dovetail/testcase/defcore.tc001.yml2
8 files changed, 52 insertions, 48 deletions
diff --git a/dovetail/compliance/debug.yml b/dovetail/compliance/debug.yml
index 847251bd..c48d6b65 100644
--- a/dovetail/compliance/debug.yml
+++ b/dovetail/compliance/debug.yml
@@ -7,10 +7,10 @@ debug:
testcases_list:
- dovetail.example.tc002
- dovetail.defcore.tc001
- - dovetail.ipv6.tc008
- - dovetail.ipv6.tc009
- - dovetail.ipv6.tc018
- - dovetail.ipv6.tc019
+# - dovetail.ipv6.tc008
+# - dovetail.ipv6.tc009
+# - dovetail.ipv6.tc018
+# - dovetail.ipv6.tc019
- dovetail.nfvi.tc001
- dovetail.nfvi.tc002
- dovetail.nfvi.tc101
diff --git a/dovetail/conf/dovetail_config.yml b/dovetail/conf/dovetail_config.yml
index b8174bdb..99e781af 100644
--- a/dovetail/conf/dovetail_config.yml
+++ b/dovetail/conf/dovetail_config.yml
@@ -7,10 +7,6 @@ report_dest: 'file'
# OPENSTACK Credential file
openrc: '/home/opnfv/dovetail/openrc.sh'
-repo:
- tag: tag_name
- path: https://github.com/opnfv/dovetail/tree/
-
COMPLIANCE_PATH: compliance/
TESTCASE_PATH: testcase/
# testsuite supported, should adjust accordingly
diff --git a/dovetail/conf/functest_config.yml b/dovetail/conf/functest_config.yml
index c65504e2..f636c204 100644
--- a/dovetail/conf/functest_config.yml
+++ b/dovetail/conf/functest_config.yml
@@ -14,5 +14,4 @@ functest:
dir: '/home/opnfv/functest/results'
store_type: 'file'
file_path: 'dump.txt'
- tp_path: 'tempest/tempest.log'
openrc: '/home/opnfv/functest/conf/openstack.creds'
diff --git a/dovetail/container.py b/dovetail/container.py
index 583f2e0c..4dd3b8f3 100644
--- a/dovetail/container.py
+++ b/dovetail/container.py
@@ -217,9 +217,9 @@ class Container(object):
return dt_utils.exec_cmd(cmd, cls.logger, exit_on_error)
@classmethod
- def pre_copy(cls, container_id, src_path, dest_path, exit_on_error=False):
- if src_path == "" or dest_path == "":
+ def pre_copy(cls, container_id, src_path, dest_path,
+ exit_on_error=False):
+ if not src_path or not dest_path:
return (1, 'src_path or dest_path is empty')
- cmd = 'sudo docker cp %s %s:%s' % (src_path, container_id, dest_path)
- cls.logger.debug('execute cmd %s', cmd)
- return dt_utils.exec_cmd(cmd, cls.logger, exit_on_error)
+ cmd = 'cp %s %s' % (src_path, dest_path)
+ return cls.exec_cmd(container_id, cmd, exit_on_error)
diff --git a/dovetail/report.py b/dovetail/report.py
index deabbdd2..6c45e00c 100644
--- a/dovetail/report.py
+++ b/dovetail/report.py
@@ -245,42 +245,39 @@ class FunctestCrawler(object):
'details': {"timestart": timestart,
"duration": testcase_duration,
"tests": '', "failures": ''}}
- elif 'tempest' in testcase_name:
+ elif testcase_name in dt_cfg.dovetail_config['functest_testsuite']:
file_path = \
os.path.join(dovetail_config['result_dir'],
- dovetail_config[self.type]['result']['tp_path'])
+ dovetail_config[self.type]['result']['file_path'])
if not os.path.exists(file_path):
self.logger.info('result file not found: %s', file_path)
return None
- with open(file_path, 'r') as myfile:
- output = myfile.read()
-
- match = re.findall('(.*?)[. ]*fail ', output)
- if match:
- error_logs = " ".join(match)
- else:
- error_logs = ""
- match = re.findall('(.*?)[. ]*skip:', output)
- if match:
- skipped = " ".join(match)
- else:
- skipped = ""
+ tests = 0
+ failed_num = 0
+ error_case = ''
+ skipped_case = ''
+ with open(file_path, 'r') as f:
+ for jsonfile in f:
+ try:
+ data = json.loads(jsonfile)
+ if testcase_name == data['case_name']:
+ criteria = data['details']['status']
+ timestart = data['details']['timestart']
+ testcase_duration = data['details']['duration']
+ tests = data['details']['tests']
+ failed_num = data['details']['failures']
+ error_case = data['details']['errors']
+ skipped_case = data['details']['skipped']
+ except Exception:
+ continue
- match = re.findall(' - Failures: (\d*)', output)
- if match:
- failed_num = int(match[0])
- else:
- failed_num = 0
- if failed_num == 0:
- criteria = 'PASS'
-
- match = re.findall('Ran: (\d*) tests in (\d*)\.\d* sec.', output)
- num_tests, dur_sec_int = match[0]
- json_results = {'criteria': criteria, 'details': {"timestart": '',
- "duration": int(dur_sec_int),
- "tests": int(num_tests), "failures": failed_num,
- "errors": error_logs,
- "skipped": skipped}}
+ json_results = {'criteria': criteria,
+ 'details': {"timestart": timestart,
+ "duration": testcase_duration,
+ "tests": tests,
+ "failures": failed_num,
+ "errors": error_case,
+ "skipped": skipped_case}}
self.logger.debug('Results: %s', str(json_results))
return json_results
diff --git a/dovetail/test_runner.py b/dovetail/test_runner.py
index 32a18743..2c1b7fd6 100644
--- a/dovetail/test_runner.py
+++ b/dovetail/test_runner.py
@@ -48,9 +48,10 @@ class DockerRunner(object):
dest_path = self.testcase.pre_copy_dest_path()
if dest_path:
- src_path = self.testcase.mk_src_file()
- ret, msg = Container.pre_copy(container_id, src_path, dest_path)
-
+ self.testcase.mk_src_file()
+ src_path = self.testcase.pre_copy_src_path(self.type)
+ ret, msg = Container.pre_copy(container_id, src_path,
+ dest_path)
if not self.testcase.prepared():
prepare_failed = False
cmds = self.testcase.pre_condition()
diff --git a/dovetail/testcase.py b/dovetail/testcase.py
index 7f218c47..21d655ef 100644
--- a/dovetail/testcase.py
+++ b/dovetail/testcase.py
@@ -115,6 +115,17 @@ class Testcase(object):
self.name())
return pre_condition
+ def pre_copy_src_path(self, test_type):
+ try:
+ pre_copy_src_file = \
+ self.testcase['validate']['pre_copy']['src_file']
+ result_dir = dt_cfg.dovetail_config[test_type]['result']['dir']
+ except KeyError as e:
+ self.logger.error('src file Key error %s', e)
+ return None
+ src_path = os.path.join(result_dir, pre_copy_src_file)
+ return src_path
+
def pre_copy_dest_path(self):
try:
pre_copy_dest_path = \
diff --git a/dovetail/testcase/defcore.tc001.yml b/dovetail/testcase/defcore.tc001.yml
index bbd2c313..39be7471 100644
--- a/dovetail/testcase/defcore.tc001.yml
+++ b/dovetail/testcase/defcore.tc001.yml
@@ -12,7 +12,7 @@ dovetail.defcore.tc001:
- 'echo test for precondition in testcase'
pre_copy:
src_file: defcore.txt
- dest_path: /home/opnfv/repos/functest/functest/opnfv_tests/openstack/refstack_client
+ dest_path: /home/opnfv/repos/functest/functest/opnfv_tests/openstack/refstack_client/defcore.txt
cmds:
- 'functest env prepare'
- 'functest testcase run refstack_defcore -r'