From 390b5a4faae503fa291b80eeded160c4359dc814 Mon Sep 17 00:00:00 2001 From: Tushar Mathur Date: Thu, 16 May 2024 14:10:56 +0530 Subject: [PATCH] chore: add an ignore annotation on simple test --- tailcall-query-plan/tests/execution.rs | 90 ++++++++++++-------------- 1 file changed, 42 insertions(+), 48 deletions(-) diff --git a/tailcall-query-plan/tests/execution.rs b/tailcall-query-plan/tests/execution.rs index 1645362ce4..6134b66b60 100644 --- a/tailcall-query-plan/tests/execution.rs +++ b/tailcall-query-plan/tests/execution.rs @@ -1,64 +1,58 @@ -// use std::fs; -// use std::path::Path; - -// use async_graphql::parser::parse_query; -// use tailcall::core::blueprint::Blueprint; -// use tailcall::core::config::{Config, ConfigModule}; -// use tailcall::core::http::RequestContext; -// use tailcall::core::valid::Validator; -// use tailcall_query_plan::execution::executor::Executor; -// use tailcall_query_plan::execution::simple::SimpleExecutionBuilder; -// use tailcall_query_plan::plan::{GeneralPlan, OperationPlan}; +use std::fs; +use std::path::Path; + +use async_graphql::parser::parse_query; +use tailcall::core::blueprint::Blueprint; +use tailcall::core::config::{Config, ConfigModule}; +use tailcall::core::http::RequestContext; +use tailcall::core::valid::Validator; +use tailcall_query_plan::execution::executor::Executor; +use tailcall_query_plan::execution::simple::SimpleExecutionBuilder; +use tailcall_query_plan::plan::{GeneralPlan, OperationPlan}; #[tokio::test] +#[ignore] +// TODO: This test hangs up sometimes async fn test_simple() { - // let root_dir = Path::new(tailcall_fixtures::configs::SELF); - // let config = - // fs::read_to_string(root_dir.join("user-posts.graphql")).unwrap(); let - // config = Config::from_sdl(&config).to_result().unwrap(); let config = - // ConfigModule::from(config); let blueprint = - // Blueprint::try_from(&config).unwrap(); + let root_dir = Path::new(tailcall_fixtures::configs::SELF); + let config = fs::read_to_string(root_dir.join("user-posts.graphql")).unwrap(); + let config = Config::from_sdl(&config).to_result().unwrap(); + let config = ConfigModule::from(config); + let blueprint = Blueprint::try_from(&config).unwrap(); - // let general_plan = GeneralPlan::from_operation(&blueprint.definitions, - // &blueprint.query()); + let general_plan = GeneralPlan::from_operation(&blueprint.definitions, &blueprint.query()); - // insta::assert_snapshot!("general_plan", general_plan); + insta::assert_snapshot!("general_plan", general_plan); - // let document = - // parse_query(fs::read_to_string(root_dir.join("user-posts-query. - // graphql")).unwrap()) .unwrap(); + let document = + parse_query(fs::read_to_string(root_dir.join("user-posts-query.graphql")).unwrap()) + .unwrap(); - // for (name, operation) in document.operations.iter() { - // let name = name.unwrap().to_string(); - // let operation_plan = - // OperationPlan::from_request(&general_plan, - // &operation.node.selection_set.node); + for (name, operation) in document.operations.iter() { + let name = name.unwrap().to_string(); + let operation_plan = + OperationPlan::from_request(&general_plan, &operation.node.selection_set.node); - // insta::assert_snapshot!(format!("{name}_operation_plan"), - // operation_plan); + insta::assert_snapshot!(format!("{name}_operation_plan"), operation_plan); - // let execution_builder = SimpleExecutionBuilder {}; - // let execution_plan = execution_builder.build(&operation_plan); + let execution_builder = SimpleExecutionBuilder {}; + let execution_plan = execution_builder.build(&operation_plan); - // insta::assert_snapshot!(format!("{name}_execution_plan"), - // execution_plan); + insta::assert_snapshot!(format!("{name}_execution_plan"), execution_plan); - // let executor = Executor::new(&general_plan, &operation_plan); + let executor = Executor::new(&general_plan, &operation_plan); - // let runtime = tailcall::cli::runtime::init(&Blueprint::default()); - // let req_ctx = RequestContext::new(runtime); - // let execution_result = executor.execute(&req_ctx, - // &execution_plan).await; + let runtime = tailcall::cli::runtime::init(&Blueprint::default()); + let req_ctx = RequestContext::new(runtime); + let execution_result = executor.execute(&req_ctx, &execution_plan).await; - // insta::assert_snapshot!(format!("{name}_execution_result"), - // execution_result); + insta::assert_snapshot!(format!("{name}_execution_result"), execution_result); - // let result = operation_plan.collect_value(execution_result); + let result = operation_plan.collect_value(execution_result); - // match result { - // Ok(result) => - // insta::assert_json_snapshot!(format!("{name}_output"), result), - // Err(err) => - // insta::assert_debug_snapshot!(format!("{name}_output"), err), } - // } + match result { + Ok(result) => insta::assert_json_snapshot!(format!("{name}_output"), result), + Err(err) => insta::assert_debug_snapshot!(format!("{name}_output"), err), + } + } }