mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
fix: use tempdir when testing static files (#6962)
This commit is contained in:
@ -163,6 +163,7 @@ pub mod test_utils {
|
||||
use reth_libmdbx::MaxReadTransactionDuration;
|
||||
use reth_primitives::fs;
|
||||
use std::{path::PathBuf, sync::Arc};
|
||||
use tempfile::TempDir;
|
||||
|
||||
/// Error during database open
|
||||
pub const ERROR_DB_OPEN: &str = "Not able to open the database file.";
|
||||
@ -233,12 +234,10 @@ pub mod test_utils {
|
||||
}
|
||||
|
||||
/// Create static_files path for testing
|
||||
pub fn create_test_static_files_dir() -> PathBuf {
|
||||
let path = tempdir_path();
|
||||
let emsg = format!("{}: {:?}", ERROR_STATIC_FILES_CREATION, path);
|
||||
|
||||
reth_primitives::fs::create_dir_all(path.clone()).expect(&emsg);
|
||||
path
|
||||
pub fn create_test_static_files_dir() -> (TempDir, PathBuf) {
|
||||
let temp_dir = TempDir::with_prefix("reth-test-static-").expect(ERROR_TEMPDIR);
|
||||
let path = temp_dir.path().to_path_buf();
|
||||
(temp_dir, path)
|
||||
}
|
||||
|
||||
/// Get a temporary directory path to use for the database
|
||||
|
||||
Reference in New Issue
Block a user