aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCédric Ollivier <cedric.ollivier@orange.com>2019-11-09 15:47:14 +0100
committerCédric Ollivier <cedric.ollivier@orange.com>2019-11-09 15:49:36 +0100
commitde35b5c2496ed65d7ef25a9ce39b49d24bfa7959 (patch)
tree06503430d246b32833e2b97b8b177691fde279cd
parent41e88f6515b177824a3b4d33183180b164d5bd61 (diff)
Add links in testcase details
It allows finding easily reports thanks to DB. Change-Id: Ib5c4400c186fd320ae87e7fd3d4404b65e996a82 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com> (cherry picked from commit 256e6b0a10d43e930ecd81078d9cbcd89ebb5a06)
-rw-r--r--xtesting/ci/run_tests.py4
-rw-r--r--xtesting/core/testcase.py10
2 files changed, 8 insertions, 6 deletions
diff --git a/xtesting/ci/run_tests.py b/xtesting/ci/run_tests.py
index 7379f092..d884a7d8 100644
--- a/xtesting/ci/run_tests.py
+++ b/xtesting/ci/run_tests.py
@@ -173,14 +173,14 @@ class Runner(object):
test_case.run(**kwargs)
except KeyError:
test_case.run()
- if self.report_flag:
- test_case.push_to_db()
result = test_case.is_successful()
LOGGER.info("Test result:\n\n%s\n", test_case)
if self.clean_flag:
test_case.clean()
if self.push_flag:
test_case.publish_artifacts()
+ if self.report_flag:
+ test_case.push_to_db()
except ImportError:
LOGGER.exception("Cannot import module %s", run_dict['module'])
except AttributeError:
diff --git a/xtesting/core/testcase.py b/xtesting/core/testcase.py
index d10fc37a..fcab1ac3 100644
--- a/xtesting/core/testcase.py
+++ b/xtesting/core/testcase.py
@@ -295,6 +295,7 @@ class TestCase(object):
six.reraise(typ, value, traceback)
path = urllib.parse.urlparse(dst_s3_url).path.strip("/")
output_str = "\n"
+ self.details["links"] = []
for root, _, files in os.walk(self.dir_results):
for pub_file in files:
# pylint: disable=no-member
@@ -304,10 +305,11 @@ class TestCase(object):
os.path.join(root, pub_file),
start=self.dir_results)))
dst_http_url = os.environ["HTTP_DST_URL"]
- output_str += "\n{}".format(
- os.path.join(dst_http_url, os.path.relpath(
- os.path.join(root, pub_file),
- start=self.dir_results)))
+ link = os.path.join(dst_http_url, os.path.relpath(
+ os.path.join(root, pub_file),
+ start=self.dir_results))
+ output_str += "\n{}".format(link)
+ self.details["links"].append(link)
self.__logger.info(
"All artifacts were successfully published: %s\n", output_str)
return TestCase.EX_OK