Skip to content

Commit

Permalink
test/e2e: wait for a first block before client cmds
Browse files Browse the repository at this point in the history
  • Loading branch information
tzemanovic committed Mar 6, 2023
1 parent f053725 commit 5d3b9e1
Showing 1 changed file with 21 additions and 15 deletions.
36 changes: 21 additions & 15 deletions tests/src/e2e/ledger_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,8 @@ fn ledger_txs_and_queries() -> Result<()> {
let mut ledger =
run_as!(test, Who::Validator(0), Bin::Node, &["ledger"], Some(40))?;

ledger.exp_string("Namada ledger node started")?;
// Wait for a first block
ledger.exp_string("Committed block hash")?;
let _bg_ledger = ledger.background();

let vp_user = wasm_abs_path(VP_USER_WASM);
Expand Down Expand Up @@ -528,7 +529,8 @@ fn masp_txs_and_queries() -> Result<()> {
let mut ledger =
run_as!(test, Who::Validator(0), Bin::Node, &["ledger"], Some(40))?;

ledger.exp_string("Namada ledger node started")?;
// Wait for a first block
ledger.exp_string("Committed block hash")?;

let _bg_ledger = ledger.background();

Expand Down Expand Up @@ -794,7 +796,8 @@ fn masp_pinned_txs() -> Result<()> {
let mut ledger =
run_as!(test, Who::Validator(0), Bin::Node, &["ledger"], Some(40))?;

ledger.exp_string("Namada ledger node started")?;
// Wait for a first block
ledger.exp_string("Committed block hash")?;

let _bg_ledger = ledger.background();

Expand Down Expand Up @@ -957,7 +960,8 @@ fn masp_incentives() -> Result<()> {
let mut ledger =
run_as!(test, Who::Validator(0), Bin::Node, &["ledger"], Some(40))?;

ledger.exp_string("Namada ledger node started")?;
// Wait for a first block
ledger.exp_string("Committed block hash")?;

let _bg_ledger = ledger.background();

Expand Down Expand Up @@ -1655,9 +1659,9 @@ fn invalid_transactions() -> Result<()> {
// 1. Run the ledger node
let mut ledger =
run_as!(test, Who::Validator(0), Bin::Node, &["ledger"], Some(40))?;
ledger.exp_string("Namada ledger node started")?;
// Wait to commit a block
ledger.exp_regex(r"Committed block hash.*, height: [0-9]+")?;

// Wait for a first block
ledger.exp_string("Committed block hash")?;

let bg_ledger = ledger.background();

Expand Down Expand Up @@ -2016,7 +2020,8 @@ fn pos_init_validator() -> Result<()> {
let mut ledger =
run_as!(test, Who::Validator(0), Bin::Node, &["ledger"], Some(40))?;

ledger.exp_string("Namada ledger node started")?;
// Wait for a first block
ledger.exp_string("Committed block hash")?;
let _bg_ledger = ledger.background();

let validator_one_rpc = get_actor_rpc(&test, &Who::Validator(0));
Expand Down Expand Up @@ -2182,10 +2187,8 @@ fn ledger_many_txs_in_a_block() -> Result<()> {
let mut ledger =
run_as!(*test, Who::Validator(0), Bin::Node, &["ledger"], Some(40))?;

ledger.exp_string("Namada ledger node started")?;

// Wait to commit a block
ledger.exp_regex(r"Committed block hash.*, height: [0-9]+")?;
// Wait for a first block
ledger.exp_string("Committed block hash")?;
let bg_ledger = ledger.background();

let validator_one_rpc = Arc::new(get_actor_rpc(&test, &Who::Validator(0)));
Expand Down Expand Up @@ -2298,7 +2301,8 @@ fn proposal_submission() -> Result<()> {
let mut ledger =
run_as!(test, Who::Validator(0), Bin::Node, &["ledger"], Some(40))?;

ledger.exp_string("Namada ledger node started")?;
// Wait for a first block
ledger.exp_string("Committed block hash")?;
let _bg_ledger = ledger.background();

let validator_one_rpc = get_actor_rpc(&test, &Who::Validator(0));
Expand Down Expand Up @@ -2649,7 +2653,8 @@ fn proposal_offline() -> Result<()> {
let mut ledger =
run_as!(test, Who::Validator(0), Bin::Node, &["ledger"], Some(20))?;

ledger.exp_string("Namada ledger node started")?;
// Wait for a first block
ledger.exp_string("Committed block hash")?;
let _bg_ledger = ledger.background();

let validator_one_rpc = get_actor_rpc(&test, &Who::Validator(0));
Expand Down Expand Up @@ -3327,7 +3332,8 @@ fn implicit_account_reveal_pk() -> Result<()> {
let mut ledger =
run_as!(test, Who::Validator(0), Bin::Node, &["ledger"], Some(40))?;

ledger.exp_string("Namada ledger node started")?;
// Wait for a first block
ledger.exp_string("Committed block hash")?;
let _bg_ledger = ledger.background();

let validator_one_rpc = get_actor_rpc(&test, &Who::Validator(0));
Expand Down

0 comments on commit 5d3b9e1

Please sign in to comment.