Skip to content

Commit a33b386

Browse files
committed
Replace tempdir with tempfile
Signed-off-by: Lann Martin <[email protected]>
1 parent 6a8b646 commit a33b386

File tree

3 files changed

+19
-71
lines changed

3 files changed

+19
-71
lines changed

Cargo.lock

Lines changed: 14 additions & 66 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/factor-key-value/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ spin-factors-test = { path = "../factors-test" }
1818
tokio = { version = "1", features = ["macros", "rt"] }
1919
spin-factor-key-value-spin = { path = "../factor-key-value-spin" }
2020
spin-factor-key-value-redis = { path = "../factor-key-value-redis" }
21-
tempdir = "0.3"
21+
tempfile = "3.12.0"
2222

2323

2424
[lints]

crates/factor-key-value/tests/factor_test.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ async fn custom_spin_key_value_works() -> anyhow::Result<()> {
101101

102102
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
103103
async fn custom_spin_key_value_works_with_absolute_path() -> anyhow::Result<()> {
104-
let tmp_dir = tempdir::TempDir::new("example")?;
104+
let tmp_dir = tempfile::TempDir::with_prefix("example")?;
105105
let db_path = tmp_dir.path().join("foo/custom.db");
106106
// Check that the db does not exist yet - it will exist by the end of the test
107107
assert!(!db_path.exists());
@@ -132,7 +132,7 @@ async fn custom_spin_key_value_works_with_absolute_path() -> anyhow::Result<()>
132132

133133
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
134134
async fn custom_spin_key_value_works_with_relative_path() -> anyhow::Result<()> {
135-
let tmp_dir = tempdir::TempDir::new("example")?;
135+
let tmp_dir = tempfile::TempDir::with_prefix("example")?;
136136
let db_path = tmp_dir.path().join("custom.db");
137137
// Check that the db does not exist yet - it will exist by the end of the test
138138
assert!(!db_path.exists());
@@ -176,7 +176,7 @@ async fn custom_redis_key_value_works() -> anyhow::Result<()> {
176176

177177
#[tokio::test]
178178
async fn misconfigured_spin_key_value_fails() -> anyhow::Result<()> {
179-
let tmp_dir = tempdir::TempDir::new("example")?;
179+
let tmp_dir = tempfile::TempDir::with_prefix("example")?;
180180
let runtime_config = toml::toml! {
181181
[key_value_store.custom]
182182
type = "spin"
@@ -198,7 +198,7 @@ async fn misconfigured_spin_key_value_fails() -> anyhow::Result<()> {
198198
// TODO(rylev): consider removing this test as it is really only a consequence of
199199
// toml deserialization and not a feature of the key-value store.
200200
async fn multiple_custom_key_value_uses_second_store() -> anyhow::Result<()> {
201-
let tmp_dir = tempdir::TempDir::new("example")?;
201+
let tmp_dir = tempfile::TempDir::with_prefix("example")?;
202202
let db_path = tmp_dir.path().join("custom.db");
203203
// Check that the db does not exist yet - it will exist by the end of the test
204204
assert!(!db_path.exists());

0 commit comments

Comments
 (0)