Skip to content

fix(core): add missing tokio test features so crates build on their own - #8103

Open
Lstarsky0 wants to merge 2 commits into
apache:mainfrom
Lstarsky0:fix/core-dev-deps-tokio-time
Open

fix(core): add missing tokio test features so crates build on their own#8103
Lstarsky0 wants to merge 2 commits into
apache:mainfrom
Lstarsky0:fix/core-dev-deps-tokio-time

Conversation

@Lstarsky0

@Lstarsky0 Lstarsky0 commented Aug 17, 2026

Copy link
Copy Markdown

Which issue does this PR close?

None. The opendal-core line also exists on #8042, a much larger transport change that is currently conflicting; this splits the build fix out so it can land on its own. The second crate is not covered there.

Rationale for this change

Two crates cannot have their tests built on their own.

cargo test -p opendal-core --no-run, on any non-wasm target:

error[E0432]: unresolved import `tokio::time`
   --> core/src/types/execute/executors/tokio_executor.rs:38:16
    |
 38 |     use tokio::time::sleep;
    |                ^^^^ could not find `time` in `tokio`

Ten sites across seven files use tokio::time, all of them inside mod tests, but time is only enabled under [target.'cfg(target_arch = "wasm32")'.dependencies].

cargo check -p opendal-layer-observe-metrics-common --tests:

error: The #[tokio::test] macro requires rt or rt-multi-thread.
    --> layers/observe-metrics-common/src/lib.rs:1538:5
     |
1538 |     #[tokio::test]
     |     ^^^^^^^^^^^^^^

Its dev-dependency asks for ["macros"] alone. The other fifteen layer crates with a tokio dev-dependency all ask for a runtime as well.

Core CI runs --workspace --all-features, so feature unification supplies both from sibling crates and neither gap is visible there. They only show up when a crate is built by itself.

What changes are included in this PR?

"time" for opendal-core, "rt-multi-thread" for opendal-layer-observe-metrics-common. taplo format expanded the first array, which crossed 80 columns.

I ran cargo check -p <crate> --tests over all 105 workspace members. Nothing else fails, apart from opendal-service-hdfs and opendal-service-rocksdb, which need system libraries I do not have locally.

Are there any user-facing changes?

No. Dev-dependencies are not part of the published build, and Cargo.lock is unchanged. cargo test -p opendal-core now runs 183 unit tests and 130 doc tests, and opendal-layer-observe-metrics-common runs 18.

AI Usage Statement

AI assisted with investigating the build failures and drafting this description. I reviewed and take responsibility for the changes. There are no known assumptions or unknowns that affect review.

… compile

Ten test-only sites use tokio::time, but the time feature is only enabled
for wasm32 targets. Building opendal-core on its own therefore fails with
"unresolved import `tokio::time`". Workspace builds hide this because
feature unification pulls the feature in from sibling crates.
@Lstarsky0
Lstarsky0 requested a review from Xuanwo as a code owner August 17, 2026 11:15
@dosubot dosubot Bot added size:XS This PR changes 0-9 lines, ignoring generated files. releases-note/fix The PR fixes a bug or has a title that begins with "fix" labels Aug 17, 2026
The crate has ten #[tokio::test] functions but its dev-dependency only
asks for the macros feature, so building its tests on their own fails
with "The #[tokio::test] macro requires rt or rt-multi-thread". The
other layer crates already ask for a runtime.
@Lstarsky0 Lstarsky0 changed the title fix(core): enable tokio/time in dev-dependencies so the crate's tests compile fix(core): add missing tokio test features so crates build on their own Aug 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

releases-note/fix The PR fixes a bug or has a title that begins with "fix" size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant