Skip to content

Commit

Permalink
chore: miss a hardcoding /tmp/xxx path
Browse files Browse the repository at this point in the history
Signed-off-by: JianMinTang <[email protected]>
  • Loading branch information
Standing-Man committed Nov 4, 2024
1 parent 8a91054 commit e34eded
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions crates/xline/src/server/maintenance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,10 @@ fn snapshot_stream(

#[cfg(test)]
mod test {
use std::{error::Error, path::PathBuf};
use std::error::Error;

use tempfile::TempDir;

use test_macros::abort_on_panic;
use tokio_stream::StreamExt;
use utils::config::EngineConfig;
Expand All @@ -285,9 +287,9 @@ mod test {
#[tokio::test]
#[abort_on_panic]
async fn test_snapshot_stream() -> Result<(), Box<dyn Error>> {
let dir = PathBuf::from("/tmp/test_snapshot_rpc");
let db_path = dir.join("db");
let snapshot_path = dir.join("snapshot");
let dir = TempDir::with_prefix("/tmp/test_snapshot_rpc").unwrap();
let db_path = dir.path().join("db");
let snapshot_path = dir.path().join("snapshot");

let db = DB::open(&EngineConfig::RocksDB(db_path.clone()))?;
let header_gen = HeaderGenerator::new(0, 0);
Expand All @@ -310,7 +312,7 @@ mod test {
assert_eq!(snap1_data, snap2_data);

snap2.clean().await.unwrap();
std::fs::remove_dir_all(dir).unwrap();
dir.close().unwrap();
Ok(())
}
}

0 comments on commit e34eded

Please sign in to comment.