Skip to content

Commit

Permalink
Merge branch 'main' into ci/cargo-nextest
Browse files Browse the repository at this point in the history
Signed-off-by: Nurzhan Saken <[email protected]>
  • Loading branch information
nxsaken authored Aug 29, 2024
2 parents bcd8536 + be22388 commit 7c167ff
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 25 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/iroha2-dev-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -195,13 +195,14 @@ jobs:
sweep-cache: true
cache-group: integration
- uses: taiki-e/install-action@nextest
- name: Run integration tests, with all features
- name: Run extra_functional tests, with all features
run: >
cargo nextest run
--all-features
--no-fail-fast
--failure-output final
-E 'test(extra_functional)' --retries 9
--test-threads 1
-E 'test(extra_functional)'
# Run the job to check that the docker containers are properly buildable
pr-generator-build:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ fn register_new_peer() -> Result<()> {
.1
.submit_blocking(register_peer)?;
peer_clients.push((&new_peer, Client::test(&new_peer.api_address)));
thread::sleep(pipeline_time * 2); // Wait for some time to allow peers to connect
thread::sleep(pipeline_time * 2 * 20); // Wait for some time to allow peers to connect

check_status(&peer_clients, 2);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,7 @@ fn unstable_network(
let mut account_has_quantity = Numeric::ZERO;

let mut rng = rand::thread_rng();
let freezers = {
let mut freezers = network.get_freeze_status_handles();
freezers.remove(0); // remove genesis peer
freezers
};
let freezers = network.get_freeze_status_handles();

//When
for _i in 0..n_transactions {
Expand Down
25 changes: 8 additions & 17 deletions core/test_network/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use iroha_primitives::{
unique_vec::UniqueVec,
};
use irohad::Iroha;
use rand::{prelude::SliceRandom, seq::IteratorRandom, thread_rng};
use rand::{prelude::SliceRandom, thread_rng};
use tempfile::TempDir;
use test_samples::{ALICE_ID, ALICE_KEYPAIR, PEER_KEYPAIR, SAMPLE_GENESIS_ACCOUNT_KEYPAIR};
use tokio::{
Expand Down Expand Up @@ -281,12 +281,7 @@ impl NetworkBuilder {
/// Returns network and client for connecting to it.
pub async fn create_with_client(self) -> (Network, Client) {
let network = self.create().await;
let client = Client::test(
&Network::peers(&network)
.choose(&mut thread_rng())
.unwrap()
.api_address,
);
let client = Client::test(&network.first_peer.api_address);
(network, client)
}

Expand All @@ -306,10 +301,11 @@ enum PeerInfo {
}

impl Network {
/// Collect the freeze handles from all the peers in the network.
/// Collect the freeze handles from all non-genesis peers in the network.
#[cfg(debug_assertions)]
pub fn get_freeze_status_handles(&self) -> Vec<irohad::FreezeStatus> {
self.peers()
self.peers
.values()
.filter_map(|peer| peer.irohad.as_ref())
.map(|iroha| iroha.freeze_status())
.cloned()
Expand All @@ -329,12 +325,7 @@ impl Network {
/// Adds peer to network and waits for it to start block
/// synchronization.
pub async fn add_peer(&self) -> (Peer, Client) {
let client = Client::test(
&Network::peers(self)
.choose(&mut thread_rng())
.unwrap()
.api_address,
);
let client = Client::test(&self.first_peer.api_address);

let mut config = Config::test();
config.sumeragi.trusted_peers.value_mut().others =
Expand Down Expand Up @@ -378,7 +369,7 @@ impl Network {
/// # Panics
/// When unsuccessful after `MAX_RETRIES`.
pub fn wait_for_genesis_committed(clients: &[Client], offline_peers: u32) {
const MAX_RETRIES: u32 = 40;
const MAX_RETRIES: u32 = 200;
wait_for_genesis_committed_with_max_retries(clients, offline_peers, MAX_RETRIES)
}

Expand All @@ -392,7 +383,7 @@ pub fn wait_for_genesis_committed_with_max_retries(
offline_peers: u32,
max_retries: u32,
) {
const POLL_PERIOD: Duration = Duration::from_millis(1000);
const POLL_PERIOD: Duration = Duration::from_millis(5000);

for _ in 0..max_retries {
let ready_peers = clients
Expand Down

0 comments on commit 7c167ff

Please sign in to comment.