Skip to content

Commit 0fa1808

Browse files
committed
Use unique temp filename in serialize test to avoid parallel-run collisions
1 parent 2beefce commit 0fa1808

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

rust/cuvs/src/ivf_sq/index.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,15 @@ mod tests {
393393
let build_params = IndexParams::new().unwrap().set_n_lists(64);
394394
let (dataset, index) = build_test_index(&res, &build_params);
395395

396-
let filepath = std::env::temp_dir().join("test_ivf_sq_index.bin");
396+
let unique = format!(
397+
"test_ivf_sq_index_{}_{}.bin",
398+
std::process::id(),
399+
std::time::SystemTime::now()
400+
.duration_since(std::time::UNIX_EPOCH)
401+
.expect("system clock before unix epoch")
402+
.as_nanos()
403+
);
404+
let filepath = std::env::temp_dir().join(unique);
397405
index.serialize(&res, &filepath).expect("failed to serialize ivf-sq index");
398406

399407
assert!(filepath.exists(), "serialized index file should exist");

0 commit comments

Comments
 (0)