From a74cabcbccc4f72d525499384366e3c2bdedc6c6 Mon Sep 17 00:00:00 2001 From: trivernis Date: Sun, 27 Feb 2022 11:34:43 +0100 Subject: [PATCH] Add dotenv support for tests Signed-off-by: trivernis --- .gitignore | 1 + Cargo.toml | 1 + tests/common.rs | 1 + 3 files changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 96ef6c0..3549fae 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /target Cargo.lock +.env \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml index 4d51952..14d1ef6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,6 +22,7 @@ lazy_static = "1.4.0" [dev-dependencies] env_logger = "0.8.4" maplit = "1.0.2" +dotenv = "0.15.0" [dev-dependencies.tokio] version = "1.8.0" diff --git a/tests/common.rs b/tests/common.rs index dba8290..576bfef 100644 --- a/tests/common.rs +++ b/tests/common.rs @@ -8,6 +8,7 @@ use std::sync::Arc; pub fn setup() { lazy_static::lazy_static! { static ref SETUP_DONE: Arc = Arc::new(AtomicBool::new(false)); } if !SETUP_DONE.swap(true, Ordering::SeqCst) { + dotenv::dotenv().expect("failed to initialize dotenv"); env_logger::builder() .filter_level(LevelFilter::Trace) .init();