Skip to content

Commit

Permalink
test/e2e/ledger_tests: add localnet genesis test using `utils test-ge…
Browse files Browse the repository at this point in the history
…nesis`
  • Loading branch information
tzemanovic committed Aug 16, 2024
1 parent d182726 commit 9bba8fd
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/scripts/e2e.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,10 @@
"e2e::ledger_tests::suspend_ledger": 30,
"e2e::ledger_tests::stop_ledger_at_height": 18,
"e2e::ledger_tests::change_consensus_key": 91,
"e2e::ledger_tests::test_localnet_genesis": 3,
"e2e::wallet_tests::wallet_address_cmds": 1,
"e2e::wallet_tests::wallet_encrypted_key_cmds": 1,
"e2e::wallet_tests::wallet_encrypted_key_cmds_env_var": 1,
"e2e::wallet_tests::wallet_unencrypted_key_cmds": 1,
"e2e::ledger_tests::masp_txs_and_queries": 82
}
}
31 changes: 30 additions & 1 deletion crates/tests/src/e2e/ledger_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ 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::config::ethereum_bridge;
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;
use namada_apps_lib::wallet;
use namada_core::chain::ChainId;
use namada_core::token::NATIVE_MAX_DECIMAL_PLACES;
use namada_sdk::address::Address;
Expand Down Expand Up @@ -2556,3 +2557,31 @@ fn masp_txs_and_queries() -> Result<()> {

Ok(())
}

/// Test localnet genesis files with `namada node utils test-genesis` command.
#[test]
fn test_localnet_genesis() -> Result<()> {
let loc = format!("{}:{}", std::file!(), std::line!());
let 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);
let mut test_genesis_result = setup::run_cmd(
Bin::Node,
[
"utils",
"test-genesis",
"--path",
&genesis_path.to_string_lossy(),
"--wasm-dir",
&wasm_dir.to_string_lossy(),
],
Some(30),
&working_dir,
dir.path(),
loc,
)?;
test_genesis_result
.exp_string("Genesis files were dry-run successfully")?;
Ok(())
}

0 comments on commit 9bba8fd

Please sign in to comment.