Skip to content

Commit

Permalink
tests/e2e: replace PoS test epoch waits with epoch-sleeps
Browse files Browse the repository at this point in the history
PoS hammered the node as fast as possible with epoch queries in its
tests to wait for a specified epoch. Instead, epoch-sleep repeatedly
until the target epoch has been reached.

This could be improved further by adding an --until parameter to
epoch-sleep.
  • Loading branch information
juped committed Jun 27, 2023
1 parent e7cc5e3 commit 5c34343
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tests/src/e2e/ledger_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1993,7 +1993,7 @@ fn pos_bonds() -> Result<()> {
delegation_withdrawable_epoch
);
}
let epoch = get_epoch(&test, &validator_one_rpc)?;
let epoch = epoch_sleep(&test, &validator_one_rpc, 40)?;
if epoch >= delegation_withdrawable_epoch {
break;
}
Expand Down Expand Up @@ -2186,7 +2186,7 @@ fn pos_rewards() -> Result<()> {
if Instant::now().duration_since(start) > loop_timeout {
panic!("Timed out waiting for epoch: {}", wait_epoch);
}
let epoch = get_epoch(&test, &validator_zero_rpc)?;
let epoch = epoch_sleep(&test, &validator_zero_rpc, 40)?;
if dbg!(epoch) >= wait_epoch {
break;
}
Expand Down Expand Up @@ -2268,7 +2268,7 @@ fn test_bond_queries() -> Result<()> {
if Instant::now().duration_since(start) > loop_timeout {
panic!("Timed out waiting for epoch: {}", 1);
}
let epoch = get_epoch(&test, &validator_one_rpc)?;
let epoch = epoch_sleep(&test, &validator_one_rpc, 40)?;
if epoch >= Epoch(4) {
break;
}
Expand Down Expand Up @@ -2325,7 +2325,7 @@ fn test_bond_queries() -> Result<()> {
if Instant::now().duration_since(start) > loop_timeout {
panic!("Timed out waiting for epoch: {}", 7);
}
let epoch = get_epoch(&test, &validator_one_rpc)?;
let epoch = epoch_sleep(&test, &validator_one_rpc, 40)?;
if epoch >= Epoch(7) {
break;
}
Expand Down Expand Up @@ -2565,7 +2565,7 @@ fn pos_init_validator() -> Result<()> {
if Instant::now().duration_since(start) > loop_timeout {
panic!("Timed out waiting for epoch: {}", earliest_update_epoch);
}
let epoch = get_epoch(&test, &non_validator_rpc)?;
let epoch = epoch_sleep(&test, &non_validator_rpc, 40)?;
if epoch >= earliest_update_epoch {
break;
}
Expand Down

0 comments on commit 5c34343

Please sign in to comment.