Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[gql][pick-2024.4.0]explicitly setup test scenario for test_query_default_page_limit (#18… #18394

Merged
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
4 changes: 2 additions & 2 deletions crates/sui-graphql-rpc/src/server/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -902,15 +902,15 @@ 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,
..Default::default()
},
..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 } } }")
Expand Down
73 changes: 32 additions & 41 deletions crates/sui-graphql-rpc/tests/e2e_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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() {
Expand Down Expand Up @@ -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#"
{
Expand Down Expand Up @@ -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}}"#;
Expand Down Expand Up @@ -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]
Expand Down
Loading