Skip to content

Remove sleep and change expectations for test_submit_exceed_max_rate#7313

Merged
roryharr merged 2 commits intoanza-xyz:masterfrom
roryharr:fix_timer_test
Aug 5, 2025
Merged

Remove sleep and change expectations for test_submit_exceed_max_rate#7313
roryharr merged 2 commits intoanza-xyz:masterfrom
roryharr:fix_timer_test

Conversation

@roryharr
Copy link
Copy Markdown

@roryharr roryharr commented Aug 4, 2025

Problem

CI is failing intermittently during this test since #7196.
The test is dispatching 120 points, waiting 2 seconds, expecting to see 100 of those points written as it is capped by the max write rate, and then a final point written when the flush is called at the end of the test.

Before the change the receiver thread woke up whenever new data was received or a timeout occurred at write_frequency/2 (write_frequency is 1s in this test), while now the receiver thread wakes up every 5ms regardless of whether data is present or not. In both cases, whenever the receiver thread wakes up, it checks to see if the duration since the last write time is greater than write_frequency and logs data if it is.

Prior to the change, with the 2 second wait the thread would not log another data point prior to flush. I printed the log times and could see the wakeup prior to the flush occurs at duration since last write: 505.140834ms, meaning it is likely always taking slightly longer than 1s. This leads to two full intervals not fitting into 1s.

With the change and the 5ms wakeup, the thread does wakeup a second time, leading to an extra metrics write, causing the test to fail

Summary of Changes

  • Reduced wait between starting metrics gathering and flushing from 2s to 1500ms.

Fixes #

@roryharr roryharr requested review from alessandrod and steviez August 4, 2025 22:45
@roryharr roryharr marked this pull request as ready for review August 4, 2025 22:49
@roryharr roryharr requested a review from brooksprumo August 4, 2025 23:19
@roryharr roryharr changed the title Reduce wait from 2s to 1500ms to fix CI Reduce wait from 2s to 1500ms in test_submit_exceed_max_rate to fix CI Regression Aug 4, 2025
brooksprumo
brooksprumo previously approved these changes Aug 4, 2025
Copy link
Copy Markdown

@brooksprumo brooksprumo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit: to unblock master.

Copy link
Copy Markdown

@steviez steviez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm looking at this one right now, give me a bit to finish reviewing

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Aug 4, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.8%. Comparing base (1286a6a) to head (a12ad77).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #7313   +/-   ##
=======================================
  Coverage    82.8%    82.8%           
=======================================
  Files         801      801           
  Lines      363318   363315    -3     
=======================================
+ Hits       300877   300886    +9     
+ Misses      62441    62429   -12     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown

@steviez steviez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rory and I jumped on a call to discuss this one real quick. Reducing the wait addressed the issue, but still left this test racy.

Instead, we removed the sleep and took advantage of the Barrier that MetricsAgent::flush() creates. The result is no more raciness + no more sleep.

@steviez
Copy link
Copy Markdown

steviez commented Aug 5, 2025

@roryharr - Since we changed direction with the PR, can you change the title ?

@roryharr roryharr changed the title Reduce wait from 2s to 1500ms in test_submit_exceed_max_rate to fix CI Regression Remove sleep and change expectations for test_submit_exceed_max_rate Aug 5, 2025
@roryharr roryharr merged commit a3e546e into anza-xyz:master Aug 5, 2025
41 checks passed
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.

4 participants