File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
agent/instrumentation/micrometer-1.0/src/test/java Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -254,7 +254,13 @@ void shouldCaptureFunctionTimer() {
254254 .register (registry );
255255
256256 // then
257- await ().atMost (Duration .ofSeconds (15 )).until (() -> getLastMeasurement ("test-function-timer" ) != null );
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
259+ 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)
263+ .until (() -> getLastMeasurement ("test-function-timer" ) != null );
258264
259265 AgentTestingMicrometerDelegate .Measurement measurement =
260266 getLastMeasurement ("test-function-timer" );
You can’t perform that action at this time.
0 commit comments