diff --git a/.github/workflows/iroha2-dev-pr.yml b/.github/workflows/iroha2-dev-pr.yml index 4f0904306b6..6130bbed02e 100644 --- a/.github/workflows/iroha2-dev-pr.yml +++ b/.github/workflows/iroha2-dev-pr.yml @@ -126,7 +126,7 @@ jobs: name: executor.wasm path: ${{ env.DOCKER_COMPOSE_PATH }} - name: Run tests - run: mold --run cargo test --no-default-features --no-fail-fast -p iroha extra_functional + run: mold --run cargo test --no-default-features --no-fail-fast -p iroha extra_functional -- --test-threads=1 # Run the job to check that the docker containers are properly buildable pr-generator-build: diff --git a/client/tests/integration/extra_functional/connected_peers.rs b/client/tests/integration/extra_functional/connected_peers.rs index fb98d69e141..46882575a72 100644 --- a/client/tests/integration/extra_functional/connected_peers.rs +++ b/client/tests/integration/extra_functional/connected_peers.rs @@ -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); diff --git a/client/tests/integration/extra_functional/unstable_network.rs b/client/tests/integration/extra_functional/unstable_network.rs index 092f7b7d334..e5bf53308cd 100644 --- a/client/tests/integration/extra_functional/unstable_network.rs +++ b/client/tests/integration/extra_functional/unstable_network.rs @@ -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 { diff --git a/core/test_network/src/lib.rs b/core/test_network/src/lib.rs index a9cc8c2275c..ea7b33d49e4 100644 --- a/core/test_network/src/lib.rs +++ b/core/test_network/src/lib.rs @@ -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::{ @@ -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) } @@ -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 { - self.peers() + self.peers + .values() .filter_map(|peer| peer.irohad.as_ref()) .map(|iroha| iroha.freeze_status()) .cloned() @@ -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 = @@ -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) } @@ -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