flaky-test: bifrost::tests::trim_log_smoke_test panicked at crates/bifrost/src/bifrost.rs:104:14
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
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.
This is probably caused by
cargo testnot splitting individual tests into individual processes but reusing the process. We still have a few globals like theDB_MANAGER(restate/crates/rocksdb/src/db_manager.rs
Line 31 in 41e606e
static DB_MANAGER: OnceLock<RocksDbManager> = OnceLock::new(); ). That's why we use
nextestto run our tests. Trycargo nextest run --all-features --target-dir target/tests -p restate-bifrostand 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?
Currently, there is no concrete plan to completely remove the global variables since it works with nextest.