Skip to content

Commit

Permalink
test: use tempdirs for genesis artifacts
Browse files Browse the repository at this point in the history
  • Loading branch information
tzemanovic committed Dec 14, 2023
1 parent 55e62f9 commit 27bd6fb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions apps/src/lib/config/genesis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ pub struct Parameters {
#[cfg(all(any(test, feature = "benches"), not(feature = "integration")))]
pub fn make_dev_genesis(
num_validators: u64,
target_chain_dir: std::path::PathBuf,
target_chain_dir: &std::path::Path,
) -> Finalized {
use std::net::{IpAddr, Ipv4Addr, SocketAddr};
use std::time::Duration;
Expand Down Expand Up @@ -545,7 +545,7 @@ pub fn make_dev_genesis(
// Write out the TOML files for benches
#[cfg(feature = "benches")]
genesis
.write_toml_files(&target_chain_dir)
.write_toml_files(target_chain_dir)
.expect("Must be able to write the finalized genesis");
#[cfg(not(feature = "benches"))]
let _ = target_chain_dir; // avoid unused warn
Expand Down
10 changes: 5 additions & 5 deletions apps/src/lib/node/ledger/shell/init_chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ where
))]
let genesis = {
let chain_dir = self.base_dir.join(chain_id);
genesis::make_dev_genesis(_num_validators, chain_dir)
genesis::make_dev_genesis(_num_validators, &chain_dir)
};
#[cfg(all(
any(test, feature = "benches"),
Expand Down Expand Up @@ -953,8 +953,8 @@ mod test {
fn test_dry_run_lookup_vp() {
let (mut shell, _x, _y, _z) = TestShell::new_at_height(0);
shell.wasm_dir = PathBuf::new();
let mut genesis = genesis::make_dev_genesis(1, &shell.base_dir);
let mut initializer = InitChainValidation::new(&mut shell, true);
let mut genesis = genesis::make_dev_genesis(1, PathBuf::new());

let mut vp_cache = HashMap::new();
let code = initializer.lookup_vp("vp_user", &genesis, &mut vp_cache);
Expand Down Expand Up @@ -996,8 +996,8 @@ mod test {
let test_dir = tempfile::tempdir().unwrap();
shell.wasm_dir = test_dir.path().into();

let genesis = genesis::make_dev_genesis(1, &shell.base_dir);
let mut initializer = InitChainValidation::new(&mut shell, true);
let genesis = genesis::make_dev_genesis(1, PathBuf::new());

let res = initializer
.store_wasms(&genesis.get_chain_parameters(PathBuf::new()));
Expand Down Expand Up @@ -1062,8 +1062,8 @@ mod test {
fn test_dry_run_init_token_balance() {
let (mut shell, _x, _y, _z) = TestShell::new_at_height(0);
shell.wasm_dir = PathBuf::new();
let mut genesis = genesis::make_dev_genesis(1, &shell.base_dir);
let mut initializer = InitChainValidation::new(&mut shell, true);
let mut genesis = genesis::make_dev_genesis(1, PathBuf::new());
let token_alias = Alias::from_str("apfel").unwrap();
genesis
.tokens
Expand All @@ -1088,8 +1088,8 @@ mod test {
fn test_dry_run_genesis_bonds() {
let (mut shell, _x, _y, _z) = TestShell::new_at_height(0);
shell.wasm_dir = PathBuf::new();
let mut genesis = genesis::make_dev_genesis(1, &shell.base_dir);
let mut initializer = InitChainValidation::new(&mut shell, true);
let mut genesis = genesis::make_dev_genesis(1, PathBuf::new());
let default_addresses: HashMap<Alias, Address> =
defaults::addresses().into_iter().collect();
let albert_address = if let Some(Address::Established(albert)) =
Expand Down

0 comments on commit 27bd6fb

Please sign in to comment.