Skip to content

Commit c0adef9

Browse files
authored
Fix flaky log probe tests (#7687)
rate limiting when evaluating probe can be triggered because of the previous test speed. need o force the sampling anyway make the test passes as expected
1 parent 8929ba1 commit c0adef9

File tree

1 file changed

+5
-2
lines changed
  • dd-java-agent/agent-debugger/src/test/java/com/datadog/debugger/probe

1 file changed

+5
-2
lines changed

dd-java-agent/agent-debugger/src/test/java/com/datadog/debugger/probe/LogProbeTest.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,11 @@ public void fillSnapshot_shouldSend(String methodLocation) {
7171
LogProbe logProbe = createLog(null).evaluateAt(MethodLocation.valueOf(methodLocation)).build();
7272
CapturedContext entryContext = new CapturedContext();
7373
CapturedContext exitContext = new CapturedContext();
74-
prepareContext(entryContext, logProbe, MethodLocation.ENTRY);
75-
prepareContext(exitContext, logProbe, MethodLocation.EXIT);
74+
LogProbe.LogStatus logEntryStatus =
75+
prepareContext(entryContext, logProbe, MethodLocation.ENTRY);
76+
logEntryStatus.setSampled(true); // force sampled to avoid rate limiting executing tests!
77+
LogProbe.LogStatus logExitStatus = prepareContext(exitContext, logProbe, MethodLocation.EXIT);
78+
logExitStatus.setSampled(true); // force sampled to avoid rate limiting executing tests!
7679
Snapshot snapshot = new Snapshot(Thread.currentThread(), logProbe, 10);
7780
assertTrue(logProbe.fillSnapshot(entryContext, exitContext, null, snapshot));
7881
}

0 commit comments

Comments
 (0)