Skip to content

Commit

Permalink
Upload the subresult logs
Browse files Browse the repository at this point in the history
  • Loading branch information
seberm committed Nov 19, 2024
1 parent 94bb196 commit ba94e41
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions tmt/steps/report/reportportal.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,13 +367,12 @@ def append_description(self, curr_description: str) -> str:

def upload_result_logs(
self,
result: tmt.Result,
result: tmt.result.BaseResult,
session: requests.Session,
item_uuid: str,
launch_uuid: str,
timestamp: str,
write_out_failures: bool = True,
) -> None:
write_out_failures: bool = True) -> None:
""" Upload all result log files into the ReportPortal instance """

for index, log_path in enumerate(result.log):
Expand All @@ -394,8 +393,8 @@ def upload_result_logs(
"level": level,
"time": timestamp})

# Write out failures
if index == 0 and write_out_failures:
# Optionally write out failures only for results which implement the failures callable
if hasattr(result, "failures") and index == 0 and write_out_failures:
message = _filter_invalid_chars(result.failures(log))
self.rp_api_post(
session=session,
Expand Down Expand Up @@ -692,14 +691,24 @@ def go(self, *, logger: Optional[tmt.log.Logger] = None) -> None:
child_item_uuid = yaml_to_dict(response.text).get("id")
assert child_item_uuid is not None

subtest_end_time = subresult.end_time or test_end_time

# Upload the subtest (child) logs
self.upload_result_logs(
result=subresult,
session=session,
item_uuid=child_item_uuid,
launch_uuid=launch_uuid,
timestamp=subtest_end_time)

# Finish the child item
response = self.rp_api_put(
session=session,
path=f"item/{child_item_uuid}",
json={
"launchUuid": launch_uuid,
"status": self.TMT_TO_RP_RESULT_STATUS[subresult.result],
"endTime": subresult.end_time or test_end_time})
"endTime": subtest_end_time})

self.verbose("uuid", child_item_uuid, "yellow", shift=2)

Expand Down

0 comments on commit ba94e41

Please sign in to comment.