Skip to content

Commit

Permalink
[gql] Increase EPOCH_DURATION_MS to reduce tests interacting with rec…
Browse files Browse the repository at this point in the history
…onfiguration (#20692)

## Description 

When we submit a transaction to the test cluster while the nodes are
reconfiguring for the new epoch, they will likely time out, causing
several tests to frequently flake out. Instead of setting the `EPOCH_DURATION_MS` really low for tests using `TestCluster`, we should bump this to a really high value, and essentially require the caller to explicitly `trigger_reconfiguration` to advance the epoch as needed. This way, transactions aren't contending for nodes while they are advancing epoch.

## Test plan 

Flakey tests pass without multiple retries

---

## Release notes

Check each box that your changes affect. If none of the boxes relate to
your changes, release notes aren't required.

For each box you select, include information after the relevant heading
that describes the impact of your changes that a user might notice and
any actions they must take to implement updates.

- [ ] Protocol: 
- [ ] Nodes (Validators and Full nodes): 
- [ ] Indexer: 
- [ ] JSON-RPC: 
- [ ] GraphQL: 
- [ ] CLI: 
- [ ] Rust SDK:
- [ ] REST API:
  • Loading branch information
wlmyng authored Dec 26, 2024
1 parent bed5641 commit 0441f76
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
4 changes: 3 additions & 1 deletion crates/sui-graphql-rpc/src/test_infra/cluster.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ use tokio_util::sync::CancellationToken;
use tracing::info;

const VALIDATOR_COUNT: usize = 4;
const EPOCH_DURATION_MS: u64 = 10000;
/// Set default epoch duration to 300s. This high value is to turn the TestCluster into a lockstep
/// network of sorts. Tests should call `trigger_reconfiguration` to advance the network's epoch.
const EPOCH_DURATION_MS: u64 = 300_000;

const ACCOUNT_NUM: usize = 20;
const GAS_OBJECT_COUNT: usize = 3;
Expand Down
1 change: 1 addition & 0 deletions crates/sui-graphql-rpc/tests/e2e_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,7 @@ async fn test_zklogin_sig_verify() {
let cluster = start_cluster(ServiceConfig::test_defaults()).await;

let test_cluster = &cluster.network.validator_fullnode_handle;
test_cluster.trigger_reconfiguration().await;
test_cluster.wait_for_epoch_all_nodes(1).await;
test_cluster.wait_for_authenticator_state_update().await;

Expand Down
4 changes: 3 additions & 1 deletion crates/sui-mvr-graphql-rpc/src/test_infra/cluster.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ use tokio_util::sync::CancellationToken;
use tracing::info;

const VALIDATOR_COUNT: usize = 4;
const EPOCH_DURATION_MS: u64 = 10000;
/// Set default epoch duration to 300s. This high value is to turn the TestCluster into a lockstep
/// network of sorts. Tests should call `trigger_reconfiguration` to advance the network's epoch.
const EPOCH_DURATION_MS: u64 = 300_000;

const ACCOUNT_NUM: usize = 20;
const GAS_OBJECT_COUNT: usize = 3;
Expand Down
1 change: 1 addition & 0 deletions crates/sui-mvr-graphql-rpc/tests/e2e_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ async fn test_zklogin_sig_verify() {
let cluster = start_cluster(ServiceConfig::test_defaults()).await;

let test_cluster = &cluster.network.validator_fullnode_handle;
test_cluster.trigger_reconfiguration().await;
test_cluster.wait_for_epoch_all_nodes(1).await;
test_cluster.wait_for_authenticator_state_update().await;

Expand Down

0 comments on commit 0441f76

Please sign in to comment.