summaryrefslogtreecommitdiff
path: root/crates/env/env_test
diff options
context:
space:
mode:
Diffstat (limited to 'crates/env/env_test')
-rw-r--r--crates/env/env_test/Cargo.toml5
-rw-r--r--crates/env/env_test/src/lib.rs24
2 files changed, 29 insertions, 0 deletions
diff --git a/crates/env/env_test/Cargo.toml b/crates/env/env_test/Cargo.toml
index 5e63c74..e4a2d14 100644
--- a/crates/env/env_test/Cargo.toml
+++ b/crates/env/env_test/Cargo.toml
@@ -4,4 +4,9 @@ edition = "2024"
version.workspace = true
[dependencies]
+tcp_connection = { path = "../../utils/tcp_connection" }
+cfg_file = { path = "../../utils/cfg_file", features = ["default"] }
env = { path = "../../env" }
+
+# Async & Networking
+tokio = { version = "1.46.1", features = ["full"] }
diff --git a/crates/env/env_test/src/lib.rs b/crates/env/env_test/src/lib.rs
index 8b13789..7c9fbcb 100644
--- a/crates/env/env_test/src/lib.rs
+++ b/crates/env/env_test/src/lib.rs
@@ -1 +1,25 @@
+use std::{
+ env::{current_dir, set_current_dir},
+ path::PathBuf,
+};
+use tokio::fs;
+
+#[cfg(test)]
+pub mod test_vault_setup_and_member_register;
+
+#[cfg(test)]
+pub mod test_virtual_file_creation_and_update;
+
+pub async fn get_and_correct_test_dir(area: &str) -> Result<PathBuf, std::io::Error> {
+ let dir = current_dir()?.join(".temp").join("test").join(area);
+ if !dir.exists() {
+ std::fs::create_dir_all(&dir)?;
+ } else {
+ // Regenerate existing directory
+ fs::remove_dir_all(&dir).await?;
+ fs::create_dir_all(&dir).await?;
+ }
+ set_current_dir(dir.clone())?;
+ Ok(dir)
+}