diff options
-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 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)) |