Fix flaky config env-var test race#675
Merged
Merged
Conversation
The config tests test_config_file_path_override_with_env_var and test_new_method_without_wassette_config_file_env both mutated the shared WASSETTE_CONFIG_FILE environment variable using a manual SetEnv helper and std::env::remove_var. When run in parallel they raced, intermittently clearing the var set by one test and causing Config::new to fall back to the default component directory. Use the temp_env crate (already used by the other env-dependent tests in this module) to serialize access to the environment variable, and remove the now-unused SetEnv helper. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
configteststest_config_file_path_override_with_env_varandtest_new_method_without_wassette_config_file_envboth mutated the sharedWASSETTE_CONFIG_FILEenvironment variable directly, so running in parallel they raced and intermittently failed CI (Config::newfell back to the default component directory). This switches them to thetemp_envcrate already used by the other env-dependent tests, which serializes env access, and removes the now-unusedSetEnvhelper.