Skip to content

Commit

Permalink
updated plan_simple_root_field_query_for_multiple_subgraphs test
Browse files Browse the repository at this point in the history
- It's no longer crashing and but the expected snapshot was not correct.
- I generated a query plan from JS federation and it matched the Rust output!
  • Loading branch information
duckki authored and dariuszkuc committed Jun 15, 2024
1 parent b4326a3 commit 5fe0413
Showing 1 changed file with 62 additions and 21 deletions.
83 changes: 62 additions & 21 deletions apollo-federation/src/query_plan/query_planner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -994,10 +994,7 @@ type User
"###);
}

// TODO: This fails with "Subgraph unexpectedly does not use federation spec"
// which seems...unusual
#[test]
#[ignore]
fn plan_simple_root_field_query_for_multiple_subgraphs() {
let supergraph = Supergraph::new(TEST_SUPERGRAPH).unwrap();
let planner = QueryPlanner::new(&supergraph, Default::default()).unwrap();
Expand All @@ -1021,26 +1018,70 @@ type User
.unwrap();
let plan = planner.build_query_plan(&document, None).unwrap();
insta::assert_snapshot!(plan, @r###"
QueryPlan {
Parallel {
Fetch(service: "accounts") {
{
QueryPlan {
Parallel {
Fetch(service: "accounts") {
{
userById(id: 1) {
name
email
}
}
}
Fetch(service: "products") {
{
bestRatedProducts {
id
avg_rating
}
name
email
}
}
},
Sequence {
Fetch(service: "reviews") {
{
bestRatedProducts {
__typename
id
... on Book {
__typename
id
reviews {
rating
}
}
... on Movie {
__typename
id
reviews {
rating
}
}
}
}
},
Flatten(path: "bestRatedProducts.@") {
Fetch(service: "products") {
{
... on Book {
__typename
id
reviews {
rating
}
}
... on Movie {
__typename
id
reviews {
rating
}
}
} =>
{
... on Book {
avg_rating
}
... on Movie {
avg_rating
}
}
},
},
},
},
}
}
}
}
"###);
}

Expand Down

0 comments on commit 5fe0413

Please sign in to comment.