Skip to content

Commit

Permalink
test/e2e/ledger: add test-genesis --check-can-sign args
Browse files Browse the repository at this point in the history
  • Loading branch information
tzemanovic committed Aug 16, 2024
1 parent 4693cfa commit 4a7a00e
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions crates/tests/src/e2e/ledger_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ use std::time::{Duration, Instant};
use color_eyre::eyre::Result;
use color_eyre::owo_colors::OwoColorize;
use namada_apps_lib::cli::context::ENV_VAR_CHAIN_ID;
use namada_apps_lib::client::utils::PRE_GENESIS_DIR;
use namada_apps_lib::config::utils::convert_tm_addr_to_socket_addr;
use namada_apps_lib::config::{self, ethereum_bridge};
use namada_apps_lib::facade::tendermint_config::net::Address as TendermintAddress;
Expand Down Expand Up @@ -2562,10 +2563,22 @@ fn masp_txs_and_queries() -> Result<()> {
#[test]
fn test_localnet_genesis() -> Result<()> {
let loc = format!("{}:{}", std::file!(), std::line!());
let dir = setup::TestDir::new();
let base_dir = setup::TestDir::new();
let working_dir = working_dir();
let genesis_path = wallet::defaults::derive_template_dir(&working_dir);
let wasm_dir = working_dir.join(config::DEFAULT_WASM_DIR);

// Path to the localnet "pre-genesis" wallet
let pre_genesis_wallet = genesis_path
.join("src")
.join(PRE_GENESIS_DIR)
.join("wallet.toml");
// Copy the pre-genesis wallet into the base-dir
let base_pre_genesis = base_dir.path().join(PRE_GENESIS_DIR);
std::fs::create_dir(&base_pre_genesis).unwrap();
std::fs::copy(pre_genesis_wallet, base_pre_genesis.join("wallet.toml"))
.unwrap();

let mut test_genesis_result = setup::run_cmd(
Bin::Node,
[
Expand All @@ -2575,13 +2588,21 @@ fn test_localnet_genesis() -> Result<()> {
&genesis_path.to_string_lossy(),
"--wasm-dir",
&wasm_dir.to_string_lossy(),
"--check-can-sign",
// Albert established addr (from `genesis/localnet/balances.toml`)
"tnam1qxfj3sf6a0meahdu9t6znp05g8zx4dkjtgyn9gfu",
// Daewon implicit addr (from `genesis/localnet/balances.toml`)
"tnam1qpca48f45pdtpcz06rue7k4kfdcjrvrux5cr3pwn",
// Validator account key (from `genesis/localnet/transactions.toml`)
"tpknam1qpg2tsrplvhu3fd7z7tq5ztc2ne3s7e2ahjl2a2cddufrzdyr752g666ytj",
],
Some(30),
&working_dir,
dir.path(),
&base_dir,
loc,
)?;
test_genesis_result
.exp_string("Genesis files were dry-run successfully")?;
test_genesis_result.assert_success();
Ok(())
}

0 comments on commit 4a7a00e

Please sign in to comment.