Skip to content

Commit

Permalink
Set different env vars for each test in debug.rs
Browse files Browse the repository at this point in the history
This is important because test run in parallel,
if both tests are changing the same env var at the
same time, we get intermittent failures.
  • Loading branch information
brizental committed Jul 14, 2020
1 parent e9f90e4 commit 83e6759
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions glean-core/src/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,8 @@ mod test {

#[test]
fn debug_option_is_correctly_loaded_from_env() {
env::set_var("GLEAN_TEST", "test");
let option: DebugOption<String> = DebugOption::new("GLEAN_TEST", None);
env::set_var("GLEAN_TEST_1", "test");
let option: DebugOption<String> = DebugOption::new("GLEAN_TEST_1", None);
assert_eq!(option.get().unwrap(), "test");
}

Expand All @@ -187,8 +187,8 @@ mod test {
}

// Invalid values from the env are not set
env::set_var("GLEAN_TEST", "invalid");
let mut option: DebugOption<String> = DebugOption::new("GLEAN_TEST", Some(validate));
env::set_var("GLEAN_TEST_2", "invalid");
let mut option: DebugOption<String> = DebugOption::new("GLEAN_TEST_2", Some(validate));
assert!(option.get().is_none());

// Valid values are set using the `set` function
Expand Down

0 comments on commit 83e6759

Please sign in to comment.