fix(test): don't create another 'state' directory when implementing ZebradTestDirExt (#4158)

* fix(test): don't create another 'state' directory when implementing ZebradTestDirExt

* fix zebra_state_conflict() test
This commit is contained in:
Conrado Gouvea 2022-04-21 22:10:28 -03:00 committed by GitHub
parent 903eabdced
commit 315eebf09c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View File

@ -1379,7 +1379,6 @@ fn zebra_state_conflict() -> Result<()> {
let mut dir_conflict_full = PathBuf::new(); let mut dir_conflict_full = PathBuf::new();
dir_conflict_full.push(dir_conflict.path()); dir_conflict_full.push(dir_conflict.path());
dir_conflict_full.push("state"); dir_conflict_full.push("state");
dir_conflict_full.push("state");
dir_conflict_full.push(format!( dir_conflict_full.push(format!(
"v{}", "v{}",
zebra_state::constants::DATABASE_FORMAT_VERSION zebra_state::constants::DATABASE_FORMAT_VERSION

View File

@ -5,7 +5,11 @@
//! Test functions in this file will not be run. //! Test functions in this file will not be run.
//! This file is only for test library code. //! This file is only for test library code.
use std::{env, path::Path, time::Duration}; use std::{
env,
path::{Path, PathBuf},
time::Duration,
};
use color_eyre::eyre::Result; use color_eyre::eyre::Result;
@ -142,7 +146,7 @@ where
fn cache_config_update_helper(self, config: &mut ZebradConfig) -> Result<Self> { fn cache_config_update_helper(self, config: &mut ZebradConfig) -> Result<Self> {
if !config.state.ephemeral { if !config.state.ephemeral {
let dir = self.as_ref(); let dir = self.as_ref();
let cache_dir = dir.join("state"); let cache_dir = PathBuf::from(dir);
config.state.cache_dir = cache_dir; config.state.cache_dir = cache_dir;
} }