Skip to content

fix(tap-agent): use unique sender ID in metrics cleanup test#913

Merged
suchapalaver merged 1 commit intomainfrom
fix/flaky-metrics-test
Jan 28, 2026
Merged

fix(tap-agent): use unique sender ID in metrics cleanup test#913
suchapalaver merged 1 commit intomainfrom
fix/flaky-metrics-test

Conversation

@MoonBoi9001
Copy link
Copy Markdown
Member

Summary

Fixes flaky test test_sender_level_gauges_cleanup_on_post_stop by using a unique sender ID for test isolation.

Problem

The test was non-deterministic because:

  • It used a shared sender ID (SENDER.1) for Prometheus metrics
  • Tests run in parallel
  • Parallel tests using the same sender label interfered with each other's metric values
Test A                          Test B (parallel)
------                          ----------------
1. Set ESCROW_BALANCE = 1000    
2. Stop sender account          1. Create sender account
3. Expect ESCROW_BALANCE = 0    2. Set MAX_FEE_PER_SENDER = 600
   ^                               ^
   FAILS: sees 600 from Test B

Solution

  • Add optional sender_id parameter to create_sender_account test helper
  • Return sender_id from create_sender_account for tests to use
  • Update the flaky test to use Address::random() for test isolation
  • Update all call sites to handle the new 6-element return tuple

🤖 Generated with Claude Code

@MoonBoi9001 MoonBoi9001 force-pushed the fix/flaky-metrics-test branch 2 times, most recently from da5f56e to 0e71d29 Compare January 28, 2026 01:07
The test_sender_level_gauges_cleanup_on_post_stop test was flaky because
it used a shared sender ID (SENDER.1) for Prometheus metrics while tests
run in parallel. Parallel tests using the same sender label could
interfere with each other's metric values.

Changes:
- Add optional sender_id parameter to create_sender_account test helper
- Return sender_id from create_sender_account for tests to use
- Update the flaky test to use Address::random() for test isolation
- Update all call sites to handle the new 6-element return tuple

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@MoonBoi9001 MoonBoi9001 force-pushed the fix/flaky-metrics-test branch from 0e71d29 to 40cf5bb Compare January 28, 2026 01:10
@coveralls
Copy link
Copy Markdown

coveralls commented Jan 28, 2026

Pull Request Test Coverage Report for Build 21420819108

Details

  • 47 of 47 (100.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.03%) to 68.26%

Totals Coverage Status
Change from base Build 21372283217: 0.03%
Covered Lines: 10293
Relevant Lines: 15079

💛 - Coveralls

@MoonBoi9001 MoonBoi9001 marked this pull request as ready for review January 28, 2026 01:47
@suchapalaver suchapalaver merged commit 83219bb into main Jan 28, 2026
12 checks passed
@suchapalaver suchapalaver deleted the fix/flaky-metrics-test branch January 28, 2026 02:35
@github-actions github-actions bot mentioned this pull request Jan 28, 2026
This was referenced Feb 5, 2026
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.

3 participants