Skip to content

Commit

Permalink
chore: Make tests run faster (MystenLabs#6023)
Browse files Browse the repository at this point in the history
... By advancing time automatically when there's no work left. Changes computed experimentally, full list of expected gains:
https://gist.github.com/745ad2177a62ed965bb29c234ea9edb7
  • Loading branch information
huitseeker authored Nov 10, 2022
1 parent 370a422 commit ede3fdd
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion crates/sui-core/src/epoch/tests/reconfiguration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ use crate::{
test_utils::to_sender_signed_transaction,
};

#[tokio::test]
#[tokio::test(flavor = "current_thread", start_paused = true)]
async fn test_start_epoch_change() {
// Create a sender, owning an object and a gas object.
let (sender, sender_key): (_, AccountKeyPair) = get_key_pair();
Expand Down
6 changes: 3 additions & 3 deletions crates/sui-core/src/unit_tests/gateway_state_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ async fn public_transfer_object(
Ok(result)
}

#[tokio::test]
#[tokio::test(flavor = "current_thread", start_paused = true)]
async fn test_public_transfer_object() {
let (addr1, key1): (_, AccountKeyPair) = get_key_pair();
let (addr2, _key2): (_, AccountKeyPair) = get_key_pair();
Expand Down Expand Up @@ -165,7 +165,7 @@ async fn test_publish() {
.unwrap();
}

#[tokio::test]
#[tokio::test(flavor = "current_thread", start_paused = true)]
async fn test_coin_split() {
let (addr1, key1): (_, AccountKeyPair) = get_key_pair();

Expand Down Expand Up @@ -698,7 +698,7 @@ async fn test_multiple_gateways() {
assert!(response.effects.status.is_ok());
}

#[tokio::test]
#[tokio::test(flavor = "current_thread", start_paused = true)]
async fn test_batch_transaction() {
let (addr1, key1): (_, AccountKeyPair) = get_key_pair();
let (addr2, _key2): (_, AccountKeyPair) = get_key_pair();
Expand Down
2 changes: 1 addition & 1 deletion crates/sui-storage/src/mutex_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ async fn test_mutex_table() {
assert!(map.unwrap().is_empty());
}

#[tokio::test]
#[tokio::test(flavor = "current_thread", start_paused = true)]
async fn test_mutex_table_bg_cleanup() {
let mutex_table = MutexTable::<String>::new_with_cleanup(
1,
Expand Down
2 changes: 1 addition & 1 deletion narwhal/primary/tests/epoch_change.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use tokio::sync::watch;
use types::ReconfigureNotification;

/// The epoch changes but the stake distribution and network addresses stay the same.
#[tokio::test]
#[tokio::test(flavor = "current_thread", start_paused = true)]
async fn test_simple_epoch_change() {
ensure_test_environment();

Expand Down
2 changes: 1 addition & 1 deletion narwhal/primary/tests/integration_tests_validator_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -847,7 +847,7 @@ async fn test_read_causal_unsigned_certificates() {
/// from primary 2. All in all the end goal is to:
/// * Primary 1 be able to retrieve both certificates 1 & 2 successfully
/// * Primary 1 be able to fetch the payload for certificates 1 & 2
#[tokio::test]
#[tokio::test(flavor = "current_thread", start_paused = true)]
async fn test_get_collections_with_missing_certificates() {
// GIVEN keys for two primary nodes
let fixture = CommitteeFixture::builder().randomize_ports(true).build();
Expand Down
2 changes: 1 addition & 1 deletion narwhal/primary/tests/nodes_bootstrapping_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use test_utils::cluster::{setup_tracing, Cluster};

use types::{PublicKeyProto, RoundsRequest};

#[tokio::test]
#[tokio::test(flavor = "current_thread", start_paused = true)]
async fn test_shutdown_bug() {
// Enabled debug tracing so we can easily observe the
// nodes logs.
Expand Down
2 changes: 1 addition & 1 deletion narwhal/test-utils/src/tests/cluster_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ async fn basic_cluster_setup() {
assert!(cluster.authorities().await.is_empty());
}

#[tokio::test]
#[tokio::test(flavor = "current_thread", start_paused = true)]
async fn cluster_setup_with_consensus_disabled() {
ensure_test_environment();
let mut cluster = Cluster::new(None, false);
Expand Down

0 comments on commit ede3fdd

Please sign in to comment.