diff --git a/crates/sui-graphql-rpc/src/server/builder.rs b/crates/sui-graphql-rpc/src/server/builder.rs index 8fc983d4c8784..18f899fe62aa5 100644 --- a/crates/sui-graphql-rpc/src/server/builder.rs +++ b/crates/sui-graphql-rpc/src/server/builder.rs @@ -902,7 +902,7 @@ pub mod tests { ); } - pub async fn test_query_default_page_limit_impl() { + pub async fn test_query_default_page_limit_impl(connection_config: ConnectionConfig) { let service_config = ServiceConfig { limits: Limits { default_page_size: 1, @@ -910,7 +910,7 @@ pub mod tests { }, ..Default::default() }; - let schema = prep_schema(None, Some(service_config)).build_schema(); + let schema = prep_schema(Some(connection_config), Some(service_config)).build_schema(); let resp = schema .execute("{ checkpoints { nodes { sequenceNumber } } }") diff --git a/crates/sui-graphql-rpc/tests/e2e_tests.rs b/crates/sui-graphql-rpc/tests/e2e_tests.rs index 5cc840e8edbf0..491678be944b6 100644 --- a/crates/sui-graphql-rpc/tests/e2e_tests.rs +++ b/crates/sui-graphql-rpc/tests/e2e_tests.rs @@ -14,6 +14,7 @@ mod tests { use sui_graphql_rpc::client::simple_client::GraphqlQueryVariable; use sui_graphql_rpc::client::ClientError; use sui_graphql_rpc::config::ConnectionConfig; + use sui_graphql_rpc::test_infra::cluster::ExecutorCluster; use sui_graphql_rpc::test_infra::cluster::DEFAULT_INTERNAL_DATA_SOURCE_PORT; use sui_types::digests::ChainIdentifier; use sui_types::gas_coin::GAS; @@ -26,6 +27,33 @@ mod tests { use tempfile::tempdir; use tokio::time::sleep; + async fn prep_cluster() -> (ConnectionConfig, ExecutorCluster) { + let rng = StdRng::from_seed([12; 32]); + let data_ingestion_path = tempdir().unwrap().into_path(); + let mut sim = Simulacrum::new_with_rng(rng); + sim.set_data_ingestion_path(data_ingestion_path.clone()); + + sim.create_checkpoint(); + sim.create_checkpoint(); + + let connection_config = ConnectionConfig::ci_integration_test_cfg(); + + let cluster = sui_graphql_rpc::test_infra::cluster::serve_executor( + connection_config.clone(), + DEFAULT_INTERNAL_DATA_SOURCE_PORT, + Arc::new(sim), + None, + data_ingestion_path, + ) + .await; + + cluster + .wait_for_checkpoint_catchup(1, Duration::from_secs(10)) + .await; + + (connection_config, cluster) + } + #[tokio::test] #[serial] async fn test_simple_client_validator_cluster() { @@ -120,26 +148,7 @@ mod tests { #[tokio::test] #[serial] async fn test_graphql_client_response() { - let rng = StdRng::from_seed([12; 32]); - let data_ingestion_path = tempdir().unwrap().into_path(); - let mut sim = Simulacrum::new_with_rng(rng); - sim.set_data_ingestion_path(data_ingestion_path.clone()); - - sim.create_checkpoint(); - sim.create_checkpoint(); - - let connection_config = ConnectionConfig::ci_integration_test_cfg(); - let cluster = sui_graphql_rpc::test_infra::cluster::serve_executor( - connection_config, - DEFAULT_INTERNAL_DATA_SOURCE_PORT, - Arc::new(sim), - None, - data_ingestion_path, - ) - .await; - cluster - .wait_for_checkpoint_catchup(0, Duration::from_secs(10)) - .await; + let (_, cluster) = prep_cluster().await; let query = r#" { @@ -168,26 +177,7 @@ mod tests { #[tokio::test] #[serial] async fn test_graphql_client_variables() { - let rng = StdRng::from_seed([12; 32]); - let data_ingestion_path = tempdir().unwrap().into_path(); - let mut sim = Simulacrum::new_with_rng(rng); - sim.set_data_ingestion_path(data_ingestion_path.clone()); - - sim.create_checkpoint(); - sim.create_checkpoint(); - - let connection_config = ConnectionConfig::ci_integration_test_cfg(); - let cluster = sui_graphql_rpc::test_infra::cluster::serve_executor( - connection_config, - DEFAULT_INTERNAL_DATA_SOURCE_PORT, - Arc::new(sim), - None, - data_ingestion_path, - ) - .await; - cluster - .wait_for_checkpoint_catchup(1, Duration::from_secs(10)) - .await; + let (_, cluster) = prep_cluster().await; let query = r#"{obj1: object(address: $framework_addr) {address} obj2: object(address: $deepbook_addr) {address}}"#; @@ -882,7 +872,8 @@ mod tests { #[tokio::test] #[serial] async fn test_query_default_page_limit() { - test_query_default_page_limit_impl().await; + let (connection_config, _) = prep_cluster().await; + test_query_default_page_limit_impl(connection_config).await; } #[tokio::test]