Skip to content

Commit 06d8141

Browse files
iduartgomezclaude
authored andcommitted
fix: add multi_thread tokio runtime to error_notification tests
The error_notification tests were failing in CI with: "can call blocking only when running on the multi-threaded runtime" This occurred because the tests defaulted to current_thread runtime, but the code uses tokio::task::block_in_place in WASM runtime and SQLite storage, which requires the multi-threaded runtime. Fixed by adding tokio_flavor = "multi_thread" and tokio_worker_threads = 4 to all three error_notification tests. Tests now pass: 4/4 error_notification tests ✅ 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 841e959 commit 06d8141

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

crates/core/tests/error_notification.rs

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,13 @@ static RNG: LazyLock<Mutex<rand::rngs::StdRng>> = LazyLock::new(|| {
4040
/// hanging indefinitely.
4141
///
4242
/// Fixes: #1858
43-
#[freenet_test(nodes = ["gateway"], timeout_secs = 60, startup_wait_secs = 10)]
43+
#[freenet_test(
44+
nodes = ["gateway"],
45+
timeout_secs = 60,
46+
startup_wait_secs = 10,
47+
tokio_flavor = "multi_thread",
48+
tokio_worker_threads = 4
49+
)]
4450
async fn test_get_error_notification(ctx: &mut TestContext) -> TestResult {
4551
let gateway = ctx.gateway()?;
4652
let ws_port = gateway.ws_port;
@@ -101,7 +107,13 @@ async fn test_get_error_notification(ctx: &mut TestContext) -> TestResult {
101107
///
102108
/// This test verifies that when a PUT operation fails (e.g., invalid contract),
103109
/// the client receives an error response rather than hanging indefinitely.
104-
#[freenet_test(nodes = ["gateway"], timeout_secs = 60, startup_wait_secs = 10)]
110+
#[freenet_test(
111+
nodes = ["gateway"],
112+
timeout_secs = 60,
113+
startup_wait_secs = 10,
114+
tokio_flavor = "multi_thread",
115+
tokio_worker_threads = 4
116+
)]
105117
async fn test_put_error_notification(ctx: &mut TestContext) -> TestResult {
106118
let gateway = ctx.gateway()?;
107119
let ws_port = gateway.ws_port;
@@ -170,7 +182,13 @@ async fn test_put_error_notification(ctx: &mut TestContext) -> TestResult {
170182
///
171183
/// This test verifies that when an UPDATE operation fails (e.g., contract doesn't exist),
172184
/// the client receives an error response rather than hanging indefinitely.
173-
#[freenet_test(nodes = ["gateway"], timeout_secs = 60, startup_wait_secs = 10)]
185+
#[freenet_test(
186+
nodes = ["gateway"],
187+
timeout_secs = 60,
188+
startup_wait_secs = 10,
189+
tokio_flavor = "multi_thread",
190+
tokio_worker_threads = 4
191+
)]
174192
async fn test_update_error_notification(ctx: &mut TestContext) -> TestResult {
175193
let gateway = ctx.gateway()?;
176194
let ws_port = gateway.ws_port;

0 commit comments

Comments
 (0)