Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion nodedb-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,15 @@ zerompk = { workspace = true, optional = true }
tokio-rustls = { workspace = true, optional = true }
rustls-pemfile = { workspace = true, optional = true }

[dev-dependencies]
# The optional `tokio` above is the crate's own dependency and stays as it is;
# these are the dev-dependencies. Native needs nothing new, but the workspace
# entry cannot be used in both: workspace features are additive, so
# `{ workspace = true }` always carries the workspace's `features = ["full"]`,
# and tokio refuses to build on wasm with anything beyond
# `sync,macros,io-util,rt,time`. The wasm entry therefore names the version and
# the features directly, which is what keeps the test targets buildable on both.
[target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies]
tokio = { workspace = true, features = ["rt", "macros"] }

[target.'cfg(target_arch = "wasm32")'.dev-dependencies]
tokio = { version = "1", default-features = false, features = ["rt", "macros", "sync", "time"] }
9 changes: 8 additions & 1 deletion nodedb-crdt/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,12 @@ subtle = { workspace = true }
getrandom = { workspace = true }

[dev-dependencies]
tokio = { workspace = true }
serde_json = { workspace = true }

# Native-only dev-dependencies. `tokio = { workspace = true }` inherits
# `features = ["full"]`, and tokio refuses fs/io-std/net/process/
# rt-multi-thread/signal on wasm; Cargo unifies dev-dependency features across
# the whole `cargo test` invocation, so it breaks every wasm test target in the
# build. No test or bench in this crate calls tokio.
[target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies]
tokio = { workspace = true }
14 changes: 12 additions & 2 deletions nodedb-mem/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,17 @@ tikv-jemalloc-ctl = { workspace = true }
libc = { workspace = true }

[dev-dependencies]
tokio = { workspace = true }
fluxbench = { workspace = true }
tracing-subscriber = { workspace = true }
tempfile = { workspace = true }

# Native-only dev-dependencies. `tokio = { workspace = true }` inherits
# `features = ["full"]`, `fluxbench` declares its own normal
# `tokio = { features = ["full"] }`, and tokio refuses
# fs/io-std/net/process/rt-multi-thread/signal on wasm; Cargo unifies
# dev-dependency features across the whole `cargo test` invocation, so either
# entry breaks every wasm test target in the build. Neither is reachable from a
# wasm test here: this crate has no tokio call sites, no benches and no tokio
# test attribute.
[target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies]
tokio = { workspace = true }
fluxbench = { workspace = true }
3 changes: 3 additions & 0 deletions nodedb-mem/src/budget.rs
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,9 @@ mod tests {
assert_eq!(budget.allocated(), 0);
}

// Drives the reserve path from real threads; `wasm32-wasip1` has none.

#[cfg(not(target_arch = "wasm32"))]
#[test]
fn concurrent_reserves() {
use std::sync::Arc;
Expand Down
12 changes: 8 additions & 4 deletions nodedb-mem/src/governor/reserve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,7 @@ impl MemoryGovernor {

#[cfg(test)]
mod tests {
use std::sync::Arc;
use std::sync::atomic::Ordering;
use std::thread;

use nodedb_types::{DatabaseId, TenantId};

use super::*;
use crate::engine_limits::EngineLimits;
Expand Down Expand Up @@ -345,8 +341,16 @@ mod tests {

// ── Concurrent reserves ───────────────────────────────────────────────────

// Drives the reserve path from real threads; `wasm32-wasip1` has none.

#[cfg(not(target_arch = "wasm32"))]
#[test]
fn concurrent_reserves_never_exceed_cap() {
use std::sync::Arc;
use std::thread;

use nodedb_types::{DatabaseId, TenantId};

let limits = EngineLimits::zeroed().with(EngineId::Vector, 10_000);
let gov = Arc::new(
MemoryGovernor::new(GovernorConfig {
Expand Down
Loading