Skip to content

Commit 36795b7

Browse files
mhdatieclaude
andcommitted
Fix retry-marker tooling breakages surfaced by CI
Three independent defects from the retry-marker work were failing pipeline 115477619 (98/377 tasks): - RetryMarkerListener used System.err, violating forbiddenApis and failing :utils:junit-utils:forbiddenApisMain (check_base). Drop the log; the marker write is best-effort and must not fail the test run. - The `dd.test.results.dir` system property set on every Test task tripped DDSpecification's strict system-property hygiene check (no non-allow-listed `dd.*`), turning every Spock spec into an initializationError. Move it out of the agent's product-config namespace to `datadog.test.results.dir`. - JUnitReport.java used LinkedHashSet without importing it, breaking collect_results.sh in after_script (non-fatal, but result/marker collection silently produced nothing). Add the missing import. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 24cccd2 commit 36795b7

3 files changed

Lines changed: 13 additions & 3 deletions

File tree

.gitlab/collect-result/JUnitReport.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import java.nio.file.StandardCopyOption;
55
import java.util.ArrayList;
66
import java.util.LinkedHashMap;
7+
import java.util.LinkedHashSet;
78
import java.util.List;
89
import java.util.Map;
910
import java.util.Set;

buildSrc/src/main/kotlin/dd-trace-java.configure-tests.gradle.kts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,10 @@ tasks.withType<Test>().configureEach {
4949
// Trick to avoid on CI: "Couldn't flush user prefs: java.util.prefs.BackingStoreException: Couldn't get file lock."
5050
// Use a task-specific user prefs directory
5151
systemProperty("java.util.prefs.userRoot", layout.buildDirectory.dir("tmp/userPrefs/$name").get().asFile.absolutePath)
52-
systemProperty("dd.test.results.dir", reports.junitXml.outputLocation.get().asFile.absolutePath)
52+
// Test-infrastructure metadata for RetryMarkerListener. Deliberately NOT in the `dd.` namespace:
53+
// that prefix is the agent's product-config namespace and is policed by DDSpecification's strict
54+
// system-property hygiene check (setupSpec asserts no non-allow-listed `dd.*` property).
55+
systemProperty("datadog.test.results.dir", reports.junitXml.outputLocation.get().asFile.absolutePath)
5356

5457
// Enable JUnit 5 auto-detection so ConfigInversionExtension (STRICT mode) is loaded automatically
5558
systemProperty("junit.jupiter.extensions.autodetection.enabled", "true")

utils/junit-utils/src/main/java/datadog/trace/junit/utils/retry/RetryMarkerListener.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@
2222

2323
public class RetryMarkerListener implements TestExecutionListener {
2424

25-
static final String OUTPUT_DIR_PROP = "dd.test.results.dir";
25+
// Not in the `dd.` namespace on purpose: that prefix is the agent's product-config namespace and
26+
// is policed by DDSpecification's strict system-property hygiene check. Keep in sync with the
27+
// `systemProperty(...)` set in dd-trace-java.configure-tests.gradle.kts.
28+
static final String OUTPUT_DIR_PROP = "datadog.test.results.dir";
2629

2730
private final Map<String, Integer> executionCounts = new ConcurrentHashMap<>();
2831
private final Map<String, TestIdentifier> identifiers = new ConcurrentHashMap<>();
@@ -48,7 +51,10 @@ public void testPlanExecutionFinished(TestPlan plan) {
4851
writeMarkerFile(outputDir, entry.getKey(), entry.getValue());
4952
}
5053
} catch (Exception ex) {
51-
System.err.println("[RetryMarkerListener] Failed to write retry markers: " + ex.getMessage());
54+
// Best-effort: a failed marker write only means a retried attempt may not be tagged as
55+
// `skip`;
56+
// never fail the test run over it. System.out/err is banned here by forbiddenApis, and the
57+
// JUnit Platform launcher has no logger on this path, so swallow rather than log.
5258
}
5359
}
5460

0 commit comments

Comments
 (0)