Skip to content

Commit

Permalink
tests: Ensure tests use mocked runtime directory
Browse files Browse the repository at this point in the history
  • Loading branch information
bcyran committed Jan 22, 2025
1 parent c6b560c commit 4774928
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tests/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ pub struct TestEnv {
pub cwd: TempDir,
pub config_dir: ChildPath,
pub cache_dir: ChildPath,
pub runtime_dir: ChildPath,
datetime: Option<DateTime<Local>>,
}

Expand All @@ -109,6 +110,7 @@ impl TestEnv {
cwd: assert_fs::TempDir::new().unwrap(),
config_dir: assert_fs::TempDir::new().unwrap().child("config"),
cache_dir: assert_fs::TempDir::new().unwrap().child("cache"),
runtime_dir: assert_fs::TempDir::new().unwrap().child("runtime"),
datetime: None,
}
}
Expand Down Expand Up @@ -136,6 +138,7 @@ impl TestEnv {
.env("TIMEWALL_DRY_RUN", "true")
.env("TIMEWALL_CONFIG_DIR", &self.config_dir.path())
.env("TIMEWALL_CACHE_DIR", &self.cache_dir.path())
.env("TIMEWALL_RUNTIME_DIR", &self.runtime_dir.path())
.args(args);
if let Some(datetime) = self.datetime {
command.env("TIMEWALL_OVERRIDE_TIME", datetime.to_rfc3339());
Expand Down

0 comments on commit 4774928

Please sign in to comment.