mirror of
https://github.com/instructkr/claw-code.git
synced 2026-04-09 01:24:49 +08:00
fix(test): add env_lock to plugin lifecycle test — closes ROADMAP #24
build_runtime_runs_plugin_lifecycle_init_and_shutdown was the only test that set/removed ANTHROPIC_API_KEY without holding the env_lock mutex. Under parallel workspace execution, other tests racing on the same env var could wipe the key mid-construction, causing a flaky credential error. Root cause: process-wide env vars are shared mutable state. All other tests that touch ANTHROPIC_API_KEY already use env_lock(). This test was the only holdout. Fix: add let _guard = env_lock(); at the top of the test.
This commit is contained in:
@@ -10816,6 +10816,9 @@ UU conflicted.rs",
|
||||
|
||||
#[test]
|
||||
fn build_runtime_runs_plugin_lifecycle_init_and_shutdown() {
|
||||
// Serialize access to process-wide env vars so parallel tests that
|
||||
// set/remove ANTHROPIC_API_KEY do not race with this test.
|
||||
let _guard = env_lock();
|
||||
let config_home = temp_dir();
|
||||
// Inject a dummy API key so runtime construction succeeds without real credentials.
|
||||
// This test only exercises plugin lifecycle (init/shutdown), never calls the API.
|
||||
|
||||
Reference in New Issue
Block a user