Skip to content

Commit 96486a3

Browse files
committed
fixes
1 parent 33e2a7d commit 96486a3

File tree

1 file changed

+16
-20
lines changed

1 file changed

+16
-20
lines changed

hack/ci-e2e-lib.sh

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -217,11 +217,14 @@ junit::createJunitReportE2Esh() {
217217
output_file="$2"
218218
status="failed"
219219
succeeded="false"
220+
body="<system-out>hack/e2e.sh script succeeded</system-out>"
220221
if [[ "$failure" == 0 ]]; then
221222
status="passed"
222223
succeeded="true"
224+
body="$(junit::createJunitReportE2EshFailureBody "${3}")"
223225
fi
224226
timestamp="$(date -u +%Y-%m-%dT%H:%M:%S)"
227+
225228
# Write header
226229
cat > "$output_file" << EOF
227230
<?xml version="1.0" encoding="UTF-8"?>
@@ -231,31 +234,24 @@ junit::createJunitReportE2Esh() {
231234
<property name="SuiteSucceeded" value="${succeeded}"/>
232235
</properties>
233236
<testcase name="hack_e2e_sh" classname="Preparation.hack_e2e_sh" status="${status}" time="0.1">
237+
${body}
238+
</testcase>
239+
</testsuite>
240+
</testsuites>
234241
EOF
235-
# Write content
236-
if [[ "$failure" == 0 ]]; then
237-
# No error, just write a message to the output file.
238-
echo "<system-out>hack/e2e.sh script succeeded</system-out>" >> "${output_file}"
239-
else
240-
failure_data_file="${3}"
241-
cat >> "$output_file" << EOF
242+
}
243+
244+
junit::createJunitReportE2EshFailureBody() {
245+
failure_data_file="${1}"
246+
cat << EOF
242247
<failure message="hack/e2e.sh script failed">
243248
<![CDATA[
244249
EOF
245-
# Erorr case, write the content of the failure data file to the output file.
246-
# Note: the sed ensures that the content does not close the CDATA section.
247-
sed 's/]]>/]]>]]&gt;<![CDATA[/g' "${failure_data_file}" >> "$output_file"
248-
249-
cat >> "$output_file" << EOF
250+
# Erorr case, write the content of the failure data file to the output file.
251+
# Note: the sed ensures that the content does not close the CDATA section.
252+
sed 's/]]>/]]>]]&gt;<![CDATA[/g' "${failure_data_file}"
253+
cat << EOF
250254
]]>
251255
</failure>
252256
EOF
253-
fi
254-
# Write footer
255-
cat >> "$output_file" << EOF
256-
</testcase>
257-
</testsuite>
258-
</testsuites>
259-
EOF
260-
261257
}

0 commit comments

Comments
 (0)