Skip to content

Commit 1e30dfb

Browse files
jkrvivianmuXxer
authored andcommitted
upstream(node): Convert several tests to simtest (#8503)
# Description of change - Upstream range: [v1.44.3, v1.45.3) - Port commit: - MystenLabs/sui@8e168f4 - Description: Convert several tests to simtest (for speedup and flakiness improvement) ## Links to any relevant issues Part of #6153 ## How the change has been tested - [x] Basic tests (linting, compilation, formatting, unit/integration tests) - [ ] Patch-specific tests (correctness, functionality coverage) - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] I have checked that new and existing unit tests pass locally with my changes
1 parent 6a1cac5 commit 1e30dfb

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

Cargo.lock

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/iota-network/Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,9 @@ tokio = { workspace = true, features = ["test-util"] }
5050

5151
# internal dependencies
5252
iota-macros.workspace = true
53+
iota-protocol-config.workspace = true
5354
iota-swarm-config.workspace = true
5455
telemetry-subscribers.workspace = true
56+
57+
[target.'cfg(msim)'.dependencies]
58+
iota-simulator.workspace = true

crates/iota-network/src/randomness/tests.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use std::collections::BTreeSet;
66

77
use fastcrypto::{groups::bls12381, serde_helpers::ToFromByteArray};
88
use fastcrypto_tbls::{mocked_dkg, nodes};
9+
use iota_macros::sim_test;
910
use iota_swarm_config::test_utils::CommitteeFixture;
1011
use iota_types::{
1112
base_types::ConciseableName,
@@ -19,7 +20,7 @@ use crate::{randomness::*, utils};
1920
type PkG = bls12381::G2Element;
2021
type EncG = bls12381::G2Element;
2122

22-
#[tokio::test]
23+
#[sim_test]
2324
async fn test_multiple_epochs() {
2425
telemetry_subscribers::init_for_testing();
2526
let committee_fixture = CommitteeFixture::generate(rand::rngs::OsRng, 0, 4);
@@ -140,7 +141,7 @@ async fn test_multiple_epochs() {
140141
assert!(rounds_seen.contains(&RandomnessRound(1)));
141142
}
142143

143-
#[tokio::test]
144+
#[sim_test]
144145
async fn test_record_own_partial_sigs() {
145146
telemetry_subscribers::init_for_testing();
146147
let committee_fixture = CommitteeFixture::generate(rand::rngs::OsRng, 0, 4);
@@ -216,7 +217,7 @@ async fn test_record_own_partial_sigs() {
216217
}
217218
}
218219

219-
#[tokio::test]
220+
#[sim_test]
220221
async fn test_receive_full_sig() {
221222
telemetry_subscribers::init_for_testing();
222223
let committee_fixture = CommitteeFixture::generate(rand::rngs::OsRng, 0, 8);
@@ -300,7 +301,7 @@ async fn test_receive_full_sig() {
300301
assert_ne!(0, bytes.len());
301302
}
302303

303-
#[tokio::test]
304+
#[sim_test]
304305
async fn test_restart_recovery() {
305306
telemetry_subscribers::init_for_testing();
306307
let committee_fixture = CommitteeFixture::generate(rand::rngs::OsRng, 0, 4);
@@ -370,7 +371,7 @@ async fn test_restart_recovery() {
370371
}
371372
}
372373

373-
#[tokio::test]
374+
#[sim_test]
374375
async fn test_byzantine_peer_handling() {
375376
telemetry_subscribers::init_for_testing();
376377
let committee_fixture = CommitteeFixture::generate(rand::rngs::OsRng, 0, 4);

0 commit comments

Comments
 (0)