mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
refactor: replace std::fs usages with reth-primitives (#5813)
This commit is contained in:
@ -157,6 +157,7 @@ pub mod test_utils {
|
||||
database::Database,
|
||||
database_metrics::{DatabaseMetadata, DatabaseMetadataValue, DatabaseMetrics},
|
||||
};
|
||||
use reth_primitives::fs;
|
||||
use std::{path::PathBuf, sync::Arc};
|
||||
|
||||
/// Error during database open
|
||||
@ -179,7 +180,7 @@ pub mod test_utils {
|
||||
fn drop(&mut self) {
|
||||
if let Some(db) = self.db.take() {
|
||||
drop(db);
|
||||
let _ = std::fs::remove_dir_all(&self.path);
|
||||
let _ = fs::remove_dir_all(&self.path);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -260,6 +261,7 @@ mod tests {
|
||||
version::{db_version_file_path, DatabaseVersionError},
|
||||
};
|
||||
use assert_matches::assert_matches;
|
||||
use reth_primitives::fs;
|
||||
use tempfile::tempdir;
|
||||
|
||||
#[test]
|
||||
@ -280,8 +282,7 @@ mod tests {
|
||||
|
||||
// Database is not empty, version file is malformed
|
||||
{
|
||||
std::fs::write(path.path().join(db_version_file_path(&path)), "invalid-version")
|
||||
.unwrap();
|
||||
fs::write(path.path().join(db_version_file_path(&path)), "invalid-version").unwrap();
|
||||
let db = init_db(&path, None);
|
||||
assert!(db.is_err());
|
||||
assert_matches!(
|
||||
@ -292,7 +293,7 @@ mod tests {
|
||||
|
||||
// Database is not empty, version file contains not matching version
|
||||
{
|
||||
std::fs::write(path.path().join(db_version_file_path(&path)), "0").unwrap();
|
||||
fs::write(path.path().join(db_version_file_path(&path)), "0").unwrap();
|
||||
let db = init_db(&path, None);
|
||||
assert!(db.is_err());
|
||||
assert_matches!(
|
||||
|
||||
Reference in New Issue
Block a user