pub fn test_env_lock() -> MutexGuard<'static, ()>Expand description
Acquires the process-global lock that serializes tests which mutate environment variables while loading configuration, returning the held guard.
ConfigurationLoader::for_tests and ConfigurationLoader::for_tests_with_provider_factory set and unset
process-wide environment variables to simulate DD_-prefixed configuration. Because the process environment is
global mutable state, any test in any crate that reads or writes environment variables relevant to configuration
loading MUST hold this lock for the duration of that access, so that all such tests serialize against each other
rather than racing.
This is exposed publicly so that tests in downstream crates can serialize against the same single lock that the loader itself uses, instead of each hand-rolling an independent (and therefore non-serializing) mutex.
Lock poisoning is intentionally ignored: the mutex guards no data (its guarded type is ()), so a panic in
another test while the lock was held leaves nothing in an inconsistent state. Propagating poisoning would only
cascade an unrelated test failure into every later env-mutating test.