From a799b727c02f92cf25e955ba7dab2eaaa79ea853 Mon Sep 17 00:00:00 2001 From: Stan Bondi Date: Tue, 12 Nov 2024 09:44:56 +0400 Subject: [PATCH] cucumber fixes --- .../tests/features/claim_burn.feature | 1 - .../tests/features/epoch_change.feature | 2 +- .../tests/features/state_sync.feature | 14 +++++++------- integration_tests/tests/features/transfer.feature | 4 ++-- integration_tests/tests/steps/network.rs | 2 +- integration_tests/tests/steps/validator_node.rs | 15 +++++++-------- 6 files changed, 18 insertions(+), 20 deletions(-) diff --git a/integration_tests/tests/features/claim_burn.feature b/integration_tests/tests/features/claim_burn.feature index 10b7a9f90..d1ad22ae2 100644 --- a/integration_tests/tests/features/claim_burn.feature +++ b/integration_tests/tests/features/claim_burn.feature @@ -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 diff --git a/integration_tests/tests/features/epoch_change.feature b/integration_tests/tests/features/epoch_change.feature index 5d65336f8..9e431d409 100644 --- a/integration_tests/tests/features/epoch_change.feature +++ b/integration_tests/tests/features/epoch_change.feature @@ -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 diff --git a/integration_tests/tests/features/state_sync.feature b/integration_tests/tests/features/state_sync.feature index 9d8258475..be480296d 100644 --- a/integration_tests/tests/features/state_sync.feature +++ b/integration_tests/tests/features/state_sync.feature @@ -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 diff --git a/integration_tests/tests/features/transfer.feature b/integration_tests/tests/features/transfer.feature index d352e62dd..04f021dbb 100644 --- a/integration_tests/tests/features/transfer.feature +++ b/integration_tests/tests/features/transfer.feature @@ -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 diff --git a/integration_tests/tests/steps/network.rs b/integration_tests/tests/steps/network.rs index 69f741806..3d50daf1c 100644 --- a/integration_tests/tests/steps/network.rs +++ b/integration_tests/tests/steps/network.rs @@ -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; } diff --git a/integration_tests/tests/steps/validator_node.rs b/integration_tests/tests/steps/validator_node.rs index dbb13df2b..e3033ce2e 100644 --- a/integration_tests/tests/steps/validator_node.rs +++ b/integration_tests/tests/steps/validator_node.rs @@ -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; @@ -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(); @@ -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; }