Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jul 2, 2025

Analyzing flaky test in agent:instrumentation:micrometer-1.0 module.

Analysis Plan

  • Examine MicrometerTest.java for potential flakiness sources
  • Identify resource leaks in shouldCaptureLongTaskTimer test
  • Add proper test cleanup between tests (@AfterEach)
  • Fix LongTaskTimer test to use finite sleep and proper cleanup
  • Add explicit timeouts to await() calls for CI stability
  • Test the changes to ensure flakiness is resolved

Key Issues Found

  1. Resource Leaks: shouldCaptureLongTaskTimer creates ExecutorService with threads that sleep indefinitely and never shuts down
  2. No Test Isolation: Static delegate accumulates measurements across tests without cleanup
  3. Missing Timeouts: await().until() calls lack explicit timeouts which can hang in CI

Minimal Fix Strategy

  • Add @AfterEach method to reset delegate between tests
  • Fix LongTaskTimer test to use controlled sleep duration and proper resource cleanup
  • Add timeouts to await() calls for robustness

Fixes #4253.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

@trask trask closed this Jul 2, 2025
Copilot AI requested a review from trask July 2, 2025 01:37
@trask trask deleted the copilot/fix-4253 branch July 23, 2025 01:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Flaky test in :agent:instrumentation:micrometer-1.0

2 participants