You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Escape special characters in the filename (such as /, &, etc.)
26
+
ESCAPED_FILE=$(printf '%s'"$XML_FILE"| sed 's/[&/\]/\\&/g')
27
+
28
+
# Insert the 'file=ESCAPED_FILE' attribute in each <testcase>
29
+
sed -i ''"/<testcase/ s/\(<testcase[^>]*\)\(\/\)/\1 file=\"$ESCAPED_FILE\"\2/""$XML_FILE"
30
+
}
31
+
20
32
# Upload test results to CI Visibility
21
33
junit_upload() {
22
34
# based on tracer implementation: https://github.com/DataDog/dd-trace-java/blob/master/dd-java-agent/agent-bootstrap/src/main/java/datadog/trace/bootstrap/instrumentation/decorator/TestDecorator.java#L55-L77
@@ -36,6 +48,11 @@ junit_upload() {
36
48
# Make sure we do not use DATADOG_API_KEY from the environment
37
49
unset DATADOG_API_KEY
38
50
51
+
# Modify the JUnit XML results by adding the 'file' attribute
52
+
forXML_FILEin ./results/*.xml;do
53
+
add_source_file_to_xml "$XML_FILE"
54
+
done
55
+
39
56
# Upload test results to production environment like all other CI jobs
40
57
junit_upload "$DATADOG_API_KEY_PROD"
41
58
# And also upload to staging environment to benefit from the new features not yet released
0 commit comments