summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorxudan <xudan16@huawei.com>2017-08-23 22:18:31 -0400
committerxudan <xudan16@huawei.com>2017-08-28 02:58:00 -0400
commit58f172f4e229dee2d76eea196c96efc69817df3d (patch)
tree1b170da2ad80683c36409ca60581bcd660378408
parent90bd864487045df3dcacb32ced88ab247606e482 (diff)
Bugfix: functest only keeps the last test case's log
JIRA: DOVETAIL-490 1. Dovetail just keeps the last tempest/defcore/ipv6/bgpvpn test's log file. 2. All log files should be kept, so users and developers can know the reason of failed test cases. 3. tempest logs will be stored in directory tempest_logs/ 4. defcore logs will be stored in directory defcore_logs/ 5. IPv6 logs will be stored in directory ipv6_logs/ 6. bgpvpn logs will be stored in directory bgpvpn_logs/ 7. All vping logs are in functest.log Change-Id: I79eae79cb32d65ce1ada3dd6f4c6dfd3945fc512 Signed-off-by: xudan <xudan16@huawei.com>
-rw-r--r--dovetail/test_runner.py24
-rw-r--r--dovetail/testcase.py1
2 files changed, 25 insertions, 0 deletions
diff --git a/dovetail/test_runner.py b/dovetail/test_runner.py
index 603156fe..b5201969 100644
--- a/dovetail/test_runner.py
+++ b/dovetail/test_runner.py
@@ -113,6 +113,9 @@ class DockerRunner(object):
Container.clean(container_id, self.type)
+ def save_logs(self):
+ pass
+
class FunctestRunner(DockerRunner):
@@ -120,6 +123,27 @@ class FunctestRunner(DockerRunner):
self.type = 'functest'
super(FunctestRunner, self).__init__(testcase)
+ def save_logs(self):
+ validate_testcase = self.testcase.validate_testcase()
+ test_area = self.testcase.name().split(".")[1]
+ result_path = os.path.join(os.environ["DOVETAIL_HOME"], 'results')
+ dest_path = os.path.join(result_path, test_area + '_logs')
+ dest_file = os.path.join(dest_path, self.testcase.name() + '.log')
+ if validate_testcase == 'tempest_custom':
+ source_file = os.path.join(result_path, 'tempest', 'tempest.log')
+ elif validate_testcase == 'refstack_defcore':
+ source_file = os.path.join(result_path, 'refstack', 'refstack.log')
+ elif validate_testcase == 'bgpvpn':
+ source_file = os.path.join(result_path, 'bgpvpn.log')
+ else:
+ source_file = None
+ if source_file:
+ if os.path.isfile(source_file):
+ os.renames(source_file, dest_file)
+ else:
+ self.logger.error("Tempest log file for test case {} is not "
+ "found.".format(self.testcase.name()))
+
class YardstickRunner(DockerRunner):
diff --git a/dovetail/testcase.py b/dovetail/testcase.py
index bdfd3d35..b6819964 100644
--- a/dovetail/testcase.py
+++ b/dovetail/testcase.py
@@ -157,6 +157,7 @@ class Testcase(object):
runner = TestRunnerFactory.create(self)
try:
runner.run()
+ runner.save_logs()
except AttributeError as e:
self.logger.exception(
'Test case: {} Exception: {}'.format(self.name, e))