-
Notifications
You must be signed in to change notification settings - Fork 259
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add an ignore annotation on simple test
- Loading branch information
1 parent
81d7367
commit 390b5a4
Showing
1 changed file
with
42 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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), | ||
} | ||
} | ||
} |
390b5a4
There was a problem hiding this comment.
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
439405 requests in 30.00s, 2.20GB read
Requests/sec: 14645.41
Transfer/sec: 75.17MB