pb_mapper_core/test_support.rs
1//! Shared serialisation for tests that mutate process-global credential state.
2
3/// Serialises tests that set or clear the process credential.
4///
5/// The credential is process-global, so two such tests running on different
6/// runner threads would see each other's writes. Every test that calls
7/// `set_process_msg_header_key` — in this crate and in the auth, protocol, and
8/// server crates — takes this first.
9///
10/// It lives here, next to the state it guards, and is unconditionally `pub`
11/// rather than `#[cfg(test)]`: a test-only item is not visible to another
12/// crate's tests, because each crate compiles its own test configuration.
13pub static PROCESS_CREDENTIAL_TEST_LOCK: std::sync::LazyLock<tokio::sync::Mutex<()>> =
14 std::sync::LazyLock::new(|| tokio::sync::Mutex::new(()));