File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed
Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -127,9 +127,13 @@ fn env_parse<T: std::str::FromStr>(key: &str, default: T) -> T {
127127#[ cfg( test) ]
128128mod tests {
129129 use super :: * ;
130+ use std:: sync:: Mutex ;
131+
132+ static ENV_LOCK : Mutex < ( ) > = Mutex :: new ( ( ) ) ;
130133
131134 #[ test]
132135 fn test_config_defaults ( ) {
136+ let _lock = ENV_LOCK . lock ( ) . unwrap ( ) ;
133137 let cfg = Config :: from_env ( ) . expect ( "default config should be valid" ) ;
134138 assert_eq ! ( cfg. port, DEFAULT_PORT ) ;
135139 assert_eq ! ( cfg. max_concurrent_tasks, DEFAULT_MAX_CONCURRENT ) ;
@@ -144,6 +148,7 @@ mod tests {
144148
145149 #[ test]
146150 fn test_config_rejects_zero_threshold ( ) {
151+ let _lock = ENV_LOCK . lock ( ) . unwrap ( ) ;
147152 std:: env:: set_var ( "CONSENSUS_THRESHOLD" , "0.0" ) ;
148153 let result = Config :: from_env ( ) ;
149154 std:: env:: remove_var ( "CONSENSUS_THRESHOLD" ) ;
@@ -155,6 +160,7 @@ mod tests {
155160
156161 #[ test]
157162 fn test_config_rejects_threshold_above_one ( ) {
163+ let _lock = ENV_LOCK . lock ( ) . unwrap ( ) ;
158164 std:: env:: set_var ( "CONSENSUS_THRESHOLD" , "1.5" ) ;
159165 let result = Config :: from_env ( ) ;
160166 std:: env:: remove_var ( "CONSENSUS_THRESHOLD" ) ;
You can’t perform that action at this time.
0 commit comments