zombienet_provider/shared/helpers.rs
1use std::env;
2
3/// Check if we are running in `CI` by checking the 'RUN_IN_CI' env var
4pub fn running_in_ci() -> bool {
5 env::var("RUN_IN_CI").unwrap_or_default() == "1"
6}
7
8#[cfg(test)]
9mod tests {
10 use super::*;
11
12 #[test]
13 fn check_runing_in_ci_env_var() {
14 assert!(!running_in_ci());
15 // now set the env var
16 env::set_var("RUN_IN_CI", "1");
17 assert!(running_in_ci());
18 // reset
19 env::set_var("RUN_IN_CI", "");
20 }
21}