Skip to content

Commit 8c4e7f6

Browse files
authored
[CI]Enhance elastictest pipeline, print test summary and error message for better review (sonic-net#14086)
Signed-off-by: Chun'ang Li <chunangli@microsoft.com>
1 parent ce0069b commit 8c4e7f6

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

.azure-pipelines/test_plan.py

+16
Original file line numberDiff line numberDiff line change
@@ -422,9 +422,25 @@ def poll(self, test_plan_id, interval=60, timeout=-1, expected_state="", expecte
422422
if step.get("step") == expected_state:
423423
step_status = step.get("status")
424424
break
425+
426+
# Print test summary
427+
test_summary = resp_data.get("runtime", {}).get("test_summary", None)
428+
if test_summary:
429+
print("Test summary:\n{}".format(json.dumps(test_summary, indent=4)))
430+
425431
# We fail the step only if the step_status is "FAILED".
426432
# Other status such as "SKIPPED", "CANCELED" are considered successful.
427433
if step_status == "FAILED":
434+
435+
# Print error type and message
436+
err_code = resp_data.get("runtime", {}).get("err_code", None)
437+
if err_code:
438+
print("Error type: {}".format(err_code))
439+
440+
err_msg = resp_data.get("runtime", {}).get("message", None)
441+
if err_msg:
442+
print("Error message: {}".format(err_msg))
443+
428444
raise Exception("Test plan id: {}, status: {}, result: {}, Elapsed {:.0f} seconds. "
429445
"Check {}/scheduler/testplan/{} for test plan status"
430446
.format(test_plan_id, step_status, result, time.time() - start_time,

0 commit comments

Comments
 (0)