diff options
author | Leo wang <grakiss.wanglei@huawei.com> | 2017-08-28 07:26:58 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2017-08-28 07:26:58 +0000 |
commit | 9cae583b2e411901d67ed63d5a75487ffde8e456 (patch) | |
tree | cad45bc701cf26611e12915786219db3bd7039ce | |
parent | fdc5e2bc2ce6a3e813b6ba461d822c26f964c07b (diff) | |
parent | 58f172f4e229dee2d76eea196c96efc69817df3d (diff) |
Merge "Bugfix: functest only keeps the last test case's log"
-rw-r--r-- | dovetail/test_runner.py | 24 | ||||
-rw-r--r-- | dovetail/testcase.py | 1 |
2 files changed, 25 insertions, 0 deletions
diff --git a/dovetail/test_runner.py b/dovetail/test_runner.py index d6e910d3..d2697f6d 100644 --- a/dovetail/test_runner.py +++ b/dovetail/test_runner.py @@ -109,6 +109,9 @@ class DockerRunner(object): Container.clean(container_id, self.type) + def save_logs(self): + pass + class FunctestRunner(DockerRunner): @@ -116,6 +119,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)) |