Skip to content

refactor: use tokio_test::block_on in tests#6858

Merged
hanabi1224 merged 1 commit intomainfrom
hm/tokio-block-on-for-tests
Apr 6, 2026
Merged

refactor: use tokio_test::block_on in tests#6858
hanabi1224 merged 1 commit intomainfrom
hm/tokio-block-on-for-tests

Conversation

@hanabi1224
Copy link
Copy Markdown
Contributor

@hanabi1224 hanabi1224 commented Apr 6, 2026

Summary of changes

Changes introduced in this pull request:

Reference issue to close (if applicable)

Closes

Other information and links

Change checklist

  • I have performed a self-review of my own code,
  • I have made corresponding changes to the documentation. All new code adheres to the team's documentation standards,
  • I have added tests that prove my fix is effective or that my feature works (if possible),
  • I have made sure the CHANGELOG is up-to-date. All user-facing changes should be reflected in this document.

Outside contributions

  • I have read and agree to the CONTRIBUTING document.
  • I have read and agree to the AI Policy document. I understand that failure to comply with the guidelines will lead to rejection of the pull request.

Summary by CodeRabbit

  • Tests
    • Updated async test execution infrastructure for improved reliability and consistency across test modules.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 6, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: ce7b0428-e027-492d-a625-f83def92db24

📥 Commits

Reviewing files that changed from the base of the PR and between 3bdb46c and ad40856.

📒 Files selected for processing (5)
  • src/db/car/forest.rs
  • src/db/car/forest/index/mod.rs
  • src/db/car/plain.rs
  • src/lib.rs
  • src/utils/db/car_util.rs
💤 Files with no reviewable changes (1)
  • src/lib.rs

Walkthrough

The PR removes the crate-local block_on helper function from the test module in src/lib.rs and migrates all test modules across the codebase to use tokio_test::block_on instead of either crate::block_on or futures::executor::block_on. This consolidates async test execution onto a single, external dependency.

Changes

Cohort / File(s) Summary
Database CAR test modules
src/db/car/forest.rs, src/db/car/forest/index/mod.rs, src/db/car/plain.rs
Switched async executor in test modules from crate::block_on or futures::executor::block_on to tokio_test::block_on via updated imports.
Utility database test module
src/utils/db/car_util.rs
Changed test module async executor from crate::block_on to tokio_test::block_on.
Crate root
src/lib.rs
Removed the internal #[cfg(test)] helper function block_on<T> that created a Tokio multi-thread runtime and executed futures.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Suggested reviewers

  • akaladarshi
  • sudo-shashank
🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: replacing crate::block_on and futures::executor::block_on with tokio_test::block_on across multiple test modules.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch hm/tokio-block-on-for-tests
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch hm/tokio-block-on-for-tests

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

@hanabi1224 hanabi1224 marked this pull request as ready for review April 6, 2026 15:19
@hanabi1224 hanabi1224 requested a review from a team as a code owner April 6, 2026 15:19
@hanabi1224 hanabi1224 requested review from akaladarshi and sudo-shashank and removed request for a team April 6, 2026 15:19
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 6, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 63.96%. Comparing base (3bdb46c) to head (ad40856).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
Files with missing lines Coverage Δ
src/db/car/forest.rs 83.18% <ø> (ø)
src/db/car/forest/index/mod.rs 87.76% <ø> (ø)
src/db/car/plain.rs 82.71% <ø> (ø)
src/utils/db/car_util.rs 88.88% <ø> (ø)

... and 9 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3bdb46c...ad40856. Read the comment docs.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@hanabi1224 hanabi1224 added this pull request to the merge queue Apr 6, 2026
Merged via the queue into main with commit d0dc5b8 Apr 6, 2026
41 checks passed
@hanabi1224 hanabi1224 deleted the hm/tokio-block-on-for-tests branch April 6, 2026 16:28
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