Skip to content

Commit

Permalink
cucumber fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
sdbondi committed Nov 12, 2024
1 parent fe1efab commit a799b72
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 20 deletions.
1 change: 0 additions & 1 deletion integration_tests/tests/features/claim_burn.feature
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ Feature: Claim Burn
@concurrent
# @serial
@fixed
@doit
Scenario: Claim base layer burn funds with wallet daemon
# Initialize a base node, wallet, miner and VN
Given a base node BASE
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/tests/features/epoch_change.feature
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Feature: Epoch change
When Block count on VN VAL is at least 6
When miner MINER mines 5 new blocks
Then VAL has scanned to height 34
Then the validator node VAL switches to epoch 2
Then the validator node VAL has ended epoch 2

# @serial
# Scenario: Committee is split into two during epoch change
Expand Down
14 changes: 7 additions & 7 deletions integration_tests/tests/features/state_sync.feature
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,17 @@ Feature: State Sync
When indexer IDX connects to all other validators

When validator node VN2 sends a registration transaction to base wallet WALLET
When miner MINER mines 20 new blocks
Then VN has scanned to height 47
Then VN2 has scanned to height 47
When miner MINER mines 23 new blocks
Then VN has scanned to height 50
Then VN2 has scanned to height 50
Then the validator node VN2 is listed as registered

When I wait for validator VN has leaf block height of at least 1 at epoch 3
When I wait for validator VN2 has leaf block height of at least 1 at epoch 3
When I wait for validator VN has leaf block height of at least 1 at epoch 5
When I wait for validator VN2 has leaf block height of at least 1 at epoch 5

When I create an account UNUSED4 via the wallet daemon WALLET_D
When I create an account UNUSED5 via the wallet daemon WALLET_D

When I wait for validator VN has leaf block height of at least 5 at epoch 3
When I wait for validator VN2 has leaf block height of at least 5 at epoch 3
When I wait for validator VN has leaf block height of at least 5 at epoch 5
When I wait for validator VN2 has leaf block height of at least 5 at epoch 5

4 changes: 2 additions & 2 deletions integration_tests/tests/features/transfer.feature
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ Feature: Account transfers
Then the validator node VN is listed as registered
Then the template "faucet" is listed as registered by the validator node VN

Then VN has scanned to height 32
Then indexer IDX has scanned to height 32
Then VN has scanned to height 42
Then indexer IDX has scanned to height 42

# Create the sender account with some tokens
When I create an account ACCOUNT_1 via the wallet daemon WALLET_D with 10000 free coins
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/tests/steps/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@ async fn start_a_network(world: &mut TariWorld, vn_name: String, walletd_name: S
miner::miner_mines_new_blocks(world, MINER_NAME.to_string(), 6).await;
wallet::check_balance(world, WALLET_NAME.to_string(), 20, "T".to_string()).await;
validator_node::send_vn_registration_with_claim_wallet(world, vn_name.clone(), WALLET_NAME.to_string()).await;
miner::miner_mines_new_blocks(world, MINER_NAME.to_string(), 16).await;
miner::miner_mines_new_blocks(world, MINER_NAME.to_string(), 26).await;
validator_node::assert_vn_is_registered(world, vn_name).await;
}
15 changes: 7 additions & 8 deletions integration_tests/tests/steps/validator_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,10 +246,10 @@ pub async fn assert_vn_is_registered(world: &mut TariWorld, vn_name: String) {
loop {
// wait for the validator to pick up the registration
let stats = client.get_epoch_manager_stats().await.unwrap();
if stats.current_block_height >= height || stats.is_valid {
if stats.current_block_height >= height || stats.committee_info.is_some() {
break;
}
if count > 10 {
if count > 20 {
panic!("Timed out waiting for validator node to pick up registration");
}
count += 1;
Expand Down Expand Up @@ -495,7 +495,7 @@ async fn when_count(world: &mut TariWorld, vn_name: String, count: u64) {
panic!("Block count on VN {vn_name} is less than {count}");
}

#[then(expr = "the validator node {word} switches to epoch {int}")]
#[then(expr = "the validator node {word} has ended epoch {int}")]
async fn then_validator_node_switches_epoch(world: &mut TariWorld, vn_name: String, epoch: u64) {
let vn = world.get_validator_node(&vn_name);
let mut client = vn.create_client();
Expand All @@ -506,18 +506,17 @@ async fn then_validator_node_switches_epoch(world: &mut TariWorld, vn_name: Stri
offset: 0,
ordering_index: None,
ordering: None,
filter_index: None,
filter: None,
filter_index: Some(1),
filter: Some(epoch.to_string()),
})
.await
.unwrap();
let blocks = list_block.blocks;
assert!(
blocks.iter().all(|b| b.epoch().as_u64() <= epoch),
blocks.iter().all(|b| b.epoch().as_u64() <= epoch + 1),
"Epoch is greater than expected"
);
if blocks.iter().any(|b| b.epoch().as_u64() == epoch) {
assert!(blocks.iter().any(|b| b.is_epoch_end()), "No end epoch block found");
if blocks.iter().any(|b| b.epoch().as_u64() == epoch && b.is_epoch_end()) {
return;
}

Expand Down

0 comments on commit a799b72

Please sign in to comment.