Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions crates/sui-benchmark/tests/simtest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,12 +227,12 @@ mod test {
#[sim_test(config = "test_config()")]
async fn test_simulated_load_rolling_restarts_all_validators() {
sui_protocol_config::ProtocolConfig::poison_get_for_min_version();
let test_cluster = build_test_cluster(4, 330_000, 1).await;
let test_cluster = build_test_cluster(4, 0, 1).await;

let validators = test_cluster.get_validator_pubkeys();
let test_cluster_clone = test_cluster.clone();
let restarter_task = tokio::task::spawn(async move {
for _ in 0..4 {
for _ in 0..2 {
for validator in validators.iter() {
info!("Killing validator {:?}", validator.concise());
test_cluster_clone.stop_node(validator);
Expand All @@ -242,9 +242,14 @@ mod test {
}
}
});
test_simulated_load(test_cluster.clone(), 330).await;
restarter_task.await.unwrap();
test_cluster.wait_for_epoch_all_nodes(1).await;
test_simulated_load(test_cluster.clone(), 170).await;

tokio::time::timeout(Duration::from_secs(20), restarter_task)
.await
.expect("Restarter task timed out")
.unwrap();

test_cluster.trigger_reconfiguration().await;
}

#[sim_test(config = "test_config()")]
Expand Down
13 changes: 12 additions & 1 deletion crates/sui-network/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,21 @@ pub const DEFAULT_CONNECT_TIMEOUT_SEC: Duration = Duration::from_secs(10);
pub const DEFAULT_REQUEST_TIMEOUT_SEC: Duration = Duration::from_secs(30);
pub const DEFAULT_HTTP2_KEEPALIVE_SEC: Duration = Duration::from_secs(5);

// Use shorter request timeout in test configurations to allow more retries during validator restarts
pub const TEST_REQUEST_TIMEOUT_SEC: Duration = Duration::from_secs(10);

static REQUEST_TIMEOUT: std::sync::LazyLock<Duration> = std::sync::LazyLock::new(|| {
if mysten_common::in_test_configuration() {
TEST_REQUEST_TIMEOUT_SEC
} else {
DEFAULT_REQUEST_TIMEOUT_SEC
}
});

pub fn default_mysten_network_config() -> Config {
let mut net_config = mysten_network::config::Config::new();
net_config.connect_timeout = Some(DEFAULT_CONNECT_TIMEOUT_SEC);
net_config.request_timeout = Some(DEFAULT_REQUEST_TIMEOUT_SEC);
net_config.request_timeout = Some(*REQUEST_TIMEOUT);
net_config.http2_keepalive_interval = Some(DEFAULT_HTTP2_KEEPALIVE_SEC);
net_config
}
Loading