Skip to content

chore(tests): fix kv alloc underflow and PQ start-count flakiness - #227

Merged
rustatian merged 2 commits into
masterfrom
fix/ci-kv-jobs-tests
Jul 16, 2026
Merged

chore(tests): fix kv alloc underflow and PQ start-count flakiness#227
rustatian merged 2 commits into
masterfrom
fix/ci-kv-jobs-tests

Conversation

@rustatian

Copy link
Copy Markdown
Member

Two test fixes:

  • kv: currAlloc-prevAlloc is uint64 and wraps when GC frees more than was allocated, raising a false "Memory leak detected". Guard the subtraction.
  • jobs: TestMemoryPQ asserted an exact "job processing was started" count (4), but that number is however many nack/re-dispatch cycles fit into the pipeline-destroy window (8 locally, 10 in CI). Assert a lower bound instead.

Signed-off-by: Valery Piashchynski <piashchynski.valery@gmail.com>
Copilot AI review requested due to automatic review settings July 16, 2026 09:15
@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@rustatian, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 38 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 2491f7c0-654a-4d70-993b-49d342e48fd0

📥 Commits

Reviewing files that changed from the base of the PR and between 688e14b and b3d3960.

📒 Files selected for processing (3)
  • memorykv/driver.go
  • tests/jobs_memory_test.go
  • tests/kv_memory_test.go
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/ci-kv-jobs-tests

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.

Copilot AI left a comment

Copy link
Copy Markdown

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 fixes two flaky/incorrect tests by making their assertions robust to runtime variability (Go GC effects and timing-dependent job re-dispatch loops).

Changes:

  • Prevent uint64 underflow in TestSetManyMemory by guarding the currAlloc - prevAlloc subtraction.
  • Make TestMemoryPQ resilient to timing variance by asserting a lower bound (instead of an exact count) for “job processing was started” log entries.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
tests/kv_memory_test.go Avoids false-positive “memory leak” failures when GC reduces Alloc below the pre-test baseline.
tests/jobs_memory_test.go Removes a timing-sensitive exact-count assertion and replaces it with a lower-bound check for job start logs.

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

…ar span

Signed-off-by: Valery Piashchynski <piashchynski.valery@gmail.com>
@codecov

codecov Bot commented Jul 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.02%. Comparing base (cda9e81) to head (b3d3960).
⚠️ Report is 43 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff             @@
##           master     #227       +/-   ##
===========================================
+ Coverage        0   77.02%   +77.02%     
===========================================
  Files           0        6        +6     
  Lines           0      518      +518     
===========================================
+ Hits            0      399      +399     
- Misses          0       87       +87     
- Partials        0       32       +32     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@rustatian
rustatian merged commit 5875150 into master Jul 16, 2026
11 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.

2 participants