Skip to content

Commit 6891dc6

Browse files
Copilottrask
andcommitted
Improve FunctionTimer test robustness with explicit polling strategy for step-based metric publication
Co-authored-by: trask <[email protected]>
1 parent 2713d42 commit 6891dc6

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

agent/instrumentation/micrometer-1.0/src/test/java/MicrometerTest.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -254,12 +254,13 @@ void shouldCaptureFunctionTimer() {
254254
.register(registry);
255255

256256
// then
257-
// Use a more robust waiting strategy that accounts for step-based metric publication
258-
// Poll more frequently and give enough time for at least 2 step cycles to ensure reliability
257+
// Use a robust polling strategy for step-based metric publication:
258+
// - Poll every 100ms to catch measurements quickly
259+
// - Allow up to 15 seconds to account for potential CI load delays
260+
// - This provides sufficient time for 2-3 step publication cycles even under load
259261
await()
260-
.pollDelay(Duration.ofMillis(100)) // Start checking after small delay
261-
.pollInterval(Duration.ofMillis(100)) // Check every 100ms
262-
.atMost(Duration.ofSeconds(3)) // Allow time for 2-3 step cycles (1s each)
262+
.pollInterval(Duration.ofMillis(100))
263+
.atMost(Duration.ofSeconds(15))
263264
.until(() -> getLastMeasurement("test-function-timer") != null);
264265

265266
AgentTestingMicrometerDelegate.Measurement measurement =

0 commit comments

Comments
 (0)