mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-07 13:06:59 +02:00
tapfile_helper: fix foldable details output
This change adds a "<summary>" sub-block to the "<details>" block in markdown test reports. The test run details output, which is used to print debug and error messages of test runs in case of test failures, was meant to be fold-able, aiding readability of test reports. This is implemented using the "<details>" feature. However, we forgot to mark a "<summary>" line within the "<details>" block, leading to the blocks not being fold-able but instead being visible all the time. Signed-off-by: Thilo Fromm <thilofromm@microsoft.com>
This commit is contained in:
parent
702e2a1a6d
commit
d66ab2b2c3
@ -220,6 +220,7 @@ __tap_print_test_verdict() {
|
|||||||
local name="$2"
|
local name="$2"
|
||||||
local succeded_vendors="$3"
|
local succeded_vendors="$3"
|
||||||
local failed_vendors="$4"
|
local failed_vendors="$4"
|
||||||
|
local full_error_report="$5" # ignored
|
||||||
|
|
||||||
echo "${verdict} - ${test_name}"
|
echo "${verdict} - ${test_name}"
|
||||||
echo " ---"
|
echo " ---"
|
||||||
@ -246,6 +247,8 @@ __tap_finish_test_verdict() {
|
|||||||
local name="$2"
|
local name="$2"
|
||||||
local succeded_vendors="$3"
|
local succeded_vendors="$3"
|
||||||
local failed_vendors="$4"
|
local failed_vendors="$4"
|
||||||
|
local full_error_report="$5" # ignored
|
||||||
|
|
||||||
echo " ..."
|
echo " ..."
|
||||||
}
|
}
|
||||||
# --
|
# --
|
||||||
@ -275,6 +278,7 @@ __md_print_test_verdict() {
|
|||||||
local succeded_vendors="$3"
|
local succeded_vendors="$3"
|
||||||
local failed_vendors="$4"
|
local failed_vendors="$4"
|
||||||
|
|
||||||
|
|
||||||
v=""
|
v=""
|
||||||
if [ "${verdict}" = "not ok" ] ; then
|
if [ "${verdict}" = "not ok" ] ; then
|
||||||
v=""
|
v=""
|
||||||
@ -289,7 +293,8 @@ __md_print_test_verdict() {
|
|||||||
echo -n " ❌ Failed: ${failed_vendors}"
|
echo -n " ❌ Failed: ${failed_vendors}"
|
||||||
fi
|
fi
|
||||||
echo
|
echo
|
||||||
if [ "${verdict}" = "not ok" ] ; then
|
if [ "${verdict}" = "not ok" ] \
|
||||||
|
|| [ "${full_error_report}" = "true" -a "${failed_vendors}" ] ; then
|
||||||
echo
|
echo
|
||||||
echo "<details>"
|
echo "<details>"
|
||||||
echo
|
echo
|
||||||
@ -301,7 +306,7 @@ __md_print_test_run_diag_output() {
|
|||||||
local vendor="$1"
|
local vendor="$1"
|
||||||
local run="$2"
|
local run="$2"
|
||||||
|
|
||||||
echo "* Diagnostic output for ${vendor}, run ${run}"
|
echo "<summary> Diagnostic output for ${vendor}, run ${run}</summary>"
|
||||||
echo
|
echo
|
||||||
echo " \`\`\`"
|
echo " \`\`\`"
|
||||||
cat -
|
cat -
|
||||||
@ -316,7 +321,10 @@ __md_finish_test_verdict() {
|
|||||||
local name="$2"
|
local name="$2"
|
||||||
local succeded_vendors="$3"
|
local succeded_vendors="$3"
|
||||||
local failed_vendors="$4"
|
local failed_vendors="$4"
|
||||||
if [ "${verdict}" = "not ok" ] ; then
|
local full_error_report="$5" # ignored
|
||||||
|
|
||||||
|
if [ "${verdict}" = "not ok" ] \
|
||||||
|
|| [ "${full_error_report}" = "true" -a "${failed_vendors}" ] ; then
|
||||||
echo
|
echo
|
||||||
echo "</details>"
|
echo "</details>"
|
||||||
echo
|
echo
|
||||||
@ -414,7 +422,7 @@ function tap_generate_report() {
|
|||||||
failed="$(list_runs 0)"
|
failed="$(list_runs 0)"
|
||||||
|
|
||||||
__"${format}"_print_test_verdict "${verdict}" "${test_name}" \
|
__"${format}"_print_test_verdict "${verdict}" "${test_name}" \
|
||||||
"${succeeded}" "${failed}"
|
"${succeeded}" "${failed}" "${full_error_report}"
|
||||||
if [ -n "${failed}" ] ; then
|
if [ -n "${failed}" ] ; then
|
||||||
if [ "${verdict}" = "not ok" -o "${full_error_report}" = "true" ] ; then
|
if [ "${verdict}" = "not ok" -o "${full_error_report}" = "true" ] ; then
|
||||||
# generate diagnostic output, per failed run.
|
# generate diagnostic output, per failed run.
|
||||||
@ -440,7 +448,7 @@ function tap_generate_report() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
__"${format}"_finish_test_verdict "${verdict}" "${test_name}" \
|
__"${format}"_finish_test_verdict "${verdict}" "${test_name}" \
|
||||||
"${succeeded}" "${failed}"
|
"${succeeded}" "${failed}" "${full_error_report}"
|
||||||
done
|
done
|
||||||
|
|
||||||
__"${format}"_finish_test_report
|
__"${format}"_finish_test_report
|
||||||
|
Loading…
Reference in New Issue
Block a user