Skip to content

Commit

Permalink
Merge branch 'tomas/e2e-pos-init-validator-fix' (#3023)
Browse files Browse the repository at this point in the history
* tomas/e2e-pos-init-validator-fix:
  test/e2e/init_validator: restart new validator node right after its tx
  • Loading branch information
tzemanovic committed Apr 8, 2024
2 parents d52c924 + 6313d45 commit 659f48e
Showing 1 changed file with 28 additions and 28 deletions.
56 changes: 28 additions & 28 deletions crates/tests/src/e2e/ledger_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -982,6 +982,34 @@ fn pos_init_validator() -> Result<()> {
client.exp_string(TX_APPLIED_SUCCESS)?;
client.assert_success();

// Stop the non-validator node and run it as the new validator
let mut non_validator = bg_non_validator.foreground();
non_validator.interrupt()?;
non_validator.exp_eof()?;

// it takes a bit before the node is shutdown. We dont want flasky test.
if is_debug_mode() {
sleep(10);
} else {
sleep(5);
}

let loc = format!("{}:{}", std::file!(), std::line!());
let validator_1_base_dir = test.get_base_dir(Who::NonValidator);
let mut validator_1 = setup::run_cmd(
Bin::Node,
["ledger"],
Some(60),
&test.working_dir,
validator_1_base_dir,
loc,
)?;

validator_1.exp_string(LEDGER_STARTED)?;
validator_1.exp_string(VALIDATOR_NODE)?;
validator_1.exp_string("Committed block hash")?;
let _bg_validator_1 = validator_1.background();

// 3. Submit a delegation to the new validator First, transfer some tokens
// to the validator's key for fees:
let tx_args = vec![
Expand Down Expand Up @@ -1057,34 +1085,6 @@ fn pos_init_validator() -> Result<()> {
client.exp_string(TX_APPLIED_SUCCESS)?;
client.assert_success();

// Stop the non-validator node and run it as the new validator
let mut non_validator = bg_non_validator.foreground();
non_validator.interrupt()?;
non_validator.exp_eof()?;

// it takes a bit before the node is shutdown. We dont want flasky test.
if is_debug_mode() {
sleep(10);
} else {
sleep(5);
}

let loc = format!("{}:{}", std::file!(), std::line!());
let validator_1_base_dir = test.get_base_dir(Who::NonValidator);
let mut validator_1 = setup::run_cmd(
Bin::Node,
["ledger"],
Some(60),
&test.working_dir,
validator_1_base_dir,
loc,
)?;

validator_1.exp_string(LEDGER_STARTED)?;
validator_1.exp_string(VALIDATOR_NODE)?;
validator_1.exp_string("Committed block hash")?;
let _bg_validator_1 = validator_1.background();

// 6. Wait for the pipeline epoch when the validator's bonded stake should
// be non-zero
let epoch = get_epoch(&test, &non_validator_rpc)?;
Expand Down

0 comments on commit 659f48e

Please sign in to comment.