Skip to content

Commit

Permalink
test/e2e: fix node_connectivity test
Browse files Browse the repository at this point in the history
  • Loading branch information
tzemanovic authored and juped committed Oct 20, 2022
1 parent f4704a3 commit d09f08b
Showing 1 changed file with 29 additions and 5 deletions.
34 changes: 29 additions & 5 deletions tests/src/e2e/ledger_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ fn test_node_connectivity() -> Result<()> {

let bg_validator_0 = validator_0.background();
let bg_validator_1 = validator_1.background();
let bg_non_validator = non_validator.background();
let _bg_non_validator = non_validator.background();

// 2. Submit a valid token transfer tx
let validator_one_rpc = get_actor_rpc(&test, &Who::Validator(0));
Expand All @@ -111,15 +111,39 @@ fn test_node_connectivity() -> Result<()> {
client.exp_string("Transaction is valid.")?;
client.assert_success();

// 3. Check that all the nodes processed the tx with the same result
// 3. Check that all the nodes processed the tx and report the same balance

let mut validator_0 = bg_validator_0.foreground();
let mut validator_1 = bg_validator_1.foreground();
let mut non_validator = bg_non_validator.foreground();

let expected_result = "all VPs accepted transaction";
// We cannot check this on non-validator node as it might sync without
// applying the tx itself, but its state should be the same, checked below.
validator_0.exp_string(expected_result)?;
validator_1.exp_string(expected_result)?;
non_validator.exp_string(expected_result)?;
let _bg_validator_0 = validator_0.background();
let _bg_validator_1 = validator_1.background();

let query_balance_args = |ledger_rpc| {
vec![
"balance",
"--owner",
ALBERT,
"--token",
XAN,
"--ledger-address",
ledger_rpc,
]
};

let validator_0_rpc = get_actor_rpc(&test, &Who::Validator(0));
let validator_1_rpc = get_actor_rpc(&test, &Who::Validator(1));
let non_validator_rpc = get_actor_rpc(&test, &Who::NonValidator);
for ledger_rpc in &[validator_0_rpc, validator_1_rpc, non_validator_rpc] {
let mut client =
run!(test, Bin::Client, query_balance_args(ledger_rpc), Some(40))?;
client.exp_string("XAN: 1000010.1")?;
client.assert_success();
}

Ok(())
}
Expand Down

0 comments on commit d09f08b

Please sign in to comment.