Skip to content

Commit

Permalink
chore: add an ignore annotation on simple test
Browse files Browse the repository at this point in the history
  • Loading branch information
tusharmath committed May 16, 2024
1 parent 81d7367 commit 390b5a4
Showing 1 changed file with 42 additions and 48 deletions.
90 changes: 42 additions & 48 deletions tailcall-query-plan/tests/execution.rs
Original file line number Diff line number Diff line change
@@ -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),
}
}
}

1 comment on commit 390b5a4

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Running 30s test @ http://localhost:8000/graphql

4 threads and 100 connections

Thread Stats Avg Stdev Max +/- Stdev
Latency 6.87ms 3.12ms 80.33ms 71.10%
Req/Sec 3.68k 160.63 4.04k 92.08%

439405 requests in 30.00s, 2.20GB read

Requests/sec: 14645.41

Transfer/sec: 75.17MB

Please sign in to comment.