Skip to content

Fix flaky test_rate_more_per_minute - #8135

Merged
generall merged 1 commit into
qdrant:devfrom
leohenon:fix/flaky-rate-limiter-test-7485
Feb 15, 2026
Merged

generall merged 1 commit into
qdrant:devfrom
leohenon:fix/flaky-rate-limiter-test-7485

Conversation

@leohenon

Copy link
Copy Markdown
Contributor

Fixes #7485
Replace exact float assertion with range check [589.0, 590.0] to tolerate
time between consume calls. Test-only.

All Submissions:

  • Contributions should target the dev branch. Did you create your branch from dev?
  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?

New Feature Submissions:

  1. Does your submission pass tests?
  2. Have you formatted your code locally using cargo +nightly fmt --all command prior to submission?
  3. Have you checked your code using cargo clippy --workspace --all-features command?

Copilot AI review requested due to automatic review settings February 15, 2026 12:58

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses flaky behavior in the RateLimiter unit test by avoiding an overly strict floating-point equality assertion that can be affected by small elapsed-time differences between try_consume calls.

Changes:

  • Replaced an exact float comparison in test_rate_more_per_minute with an inclusive range assertion to tolerate minor token refills during execution.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@coderabbitai

coderabbitai Bot commented Feb 15, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

This pull request modifies a test assertion in lib/common/common/src/rate_limiting.rs to address test flakiness. Specifically, the assertion that validates token count after consuming 10.0 tokens is changed from an exact floating-point equality check to a range-based check that verifies the value falls between 589.0 and 590.0 inclusive. No production code is modified.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

  • Fix flaky test rate limiter #6476: Applies the same fix pattern of relaxing floating-point equality checks in the same test to reduce flakiness from precision variations.

Suggested reviewers

  • agourlay
  • generall
🚥 Pre-merge checks | ✅ 6
✅ Passed checks (6 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Fix flaky test_rate_more_per_minute' clearly describes the primary change—addressing test flakiness—and directly relates to the changeset involving the rate limiting test modification.
Description check ✅ Passed The description directly addresses the changeset by referencing issue #7485, explaining the test-only change from exact float assertion to range check, and confirming test/formatting compliance.
Linked Issues check ✅ Passed The code change implements the objective from issue #7485 by replacing the exact float assertion with a range check [589.0, 590.0] to tolerate timing variations between consume calls.
Out of Scope Changes check ✅ Passed The changeset is limited to test-only modifications in rate_limiting.rs with no production code changes, staying within scope of fixing the flaky test identified in issue #7485.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into dev

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

No actionable comments were generated in the recent review. 🎉

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@generall

Copy link
Copy Markdown
Member

why not just change eps?

@leohenon

Copy link
Copy Markdown
Contributor Author

I saw eps was already increased in #6476 and it still flaked. So this avoids having to keep bumping it.

@leohenon

Copy link
Copy Markdown
Contributor Author

why not just change eps?

I think this is better because eps can drift both up and down, but tokens can only drift upward here

@generall
generall merged commit d0e2f94 into qdrant:dev Feb 15, 2026
20 of 21 checks passed
@leohenon
leohenon deleted the fix/flaky-rate-limiter-test-7485 branch February 16, 2026 00:17
timvisee pushed a commit that referenced this pull request Feb 16, 2026
KShivendu pushed a commit that referenced this pull request Mar 30, 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