restate icon indicating copy to clipboard operation
restate copied to clipboard

flaky-test: bifrost::tests::trim_log_smoke_test panicked at crates/bifrost/src/bifrost.rs:104:14

Open lsytj0413 opened this issue 9 months ago • 3 comments

When run test with cargo test -p restate-bifrost --lib -- --nocapture --test-threads=1, it failed:

test bifrost::tests::trim_log_smoke_test ... !!!! Runnning with test-util enabled !!!!
2025-03-07T09:32:12.849393Z TRACE restate_bifrost::service: Starting loglet provider local
2025-03-07T09:32:12.849465Z ERROR restate_bifrost::service: Failed to start loglet provider local: system is shutting down

thread 'bifrost::tests::trim_log_smoke_test' panicked at crates/bifrost/src/bifrost.rs:104:14:
in memory loglet must start: Failed to start loglet provider local: system is shutting down
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

lsytj0413 avatar Mar 07 '25 09:03 lsytj0413

This is probably caused by cargo test not splitting individual tests into individual processes but reusing the process. We still have a few globals like the DB_MANAGER (https://github.com/restatedev/restate/blob/41e606e6c2c6535134f0e7ee5d6bd70ce12b924a/crates/rocksdb/src/db_manager.rs#L31). That's why we use nextest to run our tests. Try cargo nextest run --all-features --target-dir target/tests -p restate-bifrost and let me know whether the tests are now passing.

tillrohrmann avatar Mar 12 '25 16:03 tillrohrmann

This is probably caused by cargo test not splitting individual tests into individual processes but reusing the process. We still have a few globals like the DB_MANAGER (

restate/crates/rocksdb/src/db_manager.rs

Line 31 in 41e606e

static DB_MANAGER: OnceLock<RocksDbManager> = OnceLock::new(); ). That's why we use nextest to run our tests. Try cargo nextest run --all-features --target-dir target/tests -p restate-bifrost and let me know whether the tests are now passing.

Yep, it's caused by DB_MANAGER was a global variables and reused by multi testcase, so all the testcases interfered with each other. Use nextest didn't reproduced this issue.

Is there any plan to reform the use of global variables?

lsytj0413 avatar Mar 13 '25 01:03 lsytj0413

Currently, there is no concrete plan to completely remove the global variables since it works with nextest.

tillrohrmann avatar Mar 18 '25 09:03 tillrohrmann