fix(core): add missing tokio test features so crates build on their own - #8103
Open
Lstarsky0 wants to merge 2 commits into
Open
fix(core): add missing tokio test features so crates build on their own#8103Lstarsky0 wants to merge 2 commits into
Lstarsky0 wants to merge 2 commits into
Conversation
… 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.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
None. The
opendal-coreline 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:Ten sites across seven files use
tokio::time, all of them insidemod tests, buttimeis only enabled under[target.'cfg(target_arch = "wasm32")'.dependencies].cargo check -p opendal-layer-observe-metrics-common --tests: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"foropendal-core,"rt-multi-thread"foropendal-layer-observe-metrics-common.taplo formatexpanded the first array, which crossed 80 columns.I ran
cargo check -p <crate> --testsover all 105 workspace members. Nothing else fails, apart fromopendal-service-hdfsandopendal-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.lockis unchanged.cargo test -p opendal-corenow runs 183 unit tests and 130 doc tests, andopendal-layer-observe-metrics-commonruns 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.