11use cucumber:: { World , given, then, when} ;
22use open_feature_flagd:: { CacheSettings , CacheType , FlagdOptions , FlagdProvider , ResolverType } ;
33use std:: collections:: HashMap ;
4- use std:: sync:: Mutex ;
54use test_log:: test;
65
7- // Global lock to ensure env var tests don't interfere with each other
8- static ENV_LOCK : Mutex < ( ) > = Mutex :: new ( ( ) ) ;
9-
106#[ derive( Debug , World ) ]
117#[ world( init = Self :: new) ]
128struct ConfigWorld {
@@ -29,7 +25,7 @@ impl ConfigWorld {
2925 fn clear ( & mut self ) {
3026 // SAFETY: Removing environment variables is safe here because:
3127 // 1. We're only removing variables that were set during this specific test scenario
32- // 2. The test is protected by #[serial_test::serial] and ENV_LOCK
28+ // 2. The test is protected by #[serial_test::serial]
3329 // 3. This prevents test pollution between scenarios
3430 // 4. All variables being removed are tracked in world.env_vars
3531 for key in self . env_vars . keys ( ) {
@@ -98,9 +94,8 @@ async fn env_with_value(world: &mut ConfigWorld, env: String, value: String) {
9894
9995 // SAFETY: Setting environment variables is safe here because:
10096 // 1. The test function is annotated with #[serial_test::serial], ensuring no parallel execution
101- // 2. We hold ENV_LOCK for the entire test duration (acquired in config_test())
102- // 3. ConfigWorld::clear() is called before each scenario to clean up all env vars
103- // 4. All env vars set during the test are tracked in world.env_vars for guaranteed cleanup
97+ // 2. ConfigWorld::clear() is called before each scenario to clean up all env vars
98+ // 3. All env vars set during the test are tracked in world.env_vars for guaranteed cleanup
10499 //
105100 // Note: We cannot use temp-env here because it only sets variables within a closure scope,
106101 // but cucumber scenarios need variables to persist across multiple async step functions.
@@ -286,9 +281,6 @@ async fn check_option_value(
286281#[ serial_test:: serial]
287282async fn config_test ( ) {
288283 // tracing_subscriber::fmt::init();
289- // Acquire global lock to ensure env var safety across scenarios
290- let _lock = ENV_LOCK . lock ( ) . unwrap ( ) ;
291-
292284 let manifest_dir = std:: env:: var ( "CARGO_MANIFEST_DIR" ) . unwrap ( ) ;
293285 let feature_path = format ! ( "{}/flagd-testbed/gherkin/config.feature" , manifest_dir) ;
294286 ConfigWorld :: cucumber ( )
0 commit comments