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

Fix running cargo test without nextest #5266

Merged
merged 1 commit into from
May 29, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -290,25 +290,7 @@ fn it_avoid_fragments_usable_only_once() {
);
}

#[test]
#[should_panic(expected = "not yet implemented")]
// TODO: investigate this failure

fn respects_query_planner_option_reuse_query_fragments_true() {
respects_query_planner_option_reuse_query_fragments(true)
}
#[test]
#[should_panic(expected = "not yet implemented")]
// TODO: investigate this failure

fn respects_query_planner_option_reuse_query_fragments_false() {
respects_query_planner_option_reuse_query_fragments(false)
}

fn respects_query_planner_option_reuse_query_fragments(reuse_query_fragments: bool) {
let planner = planner!(
config = QueryPlannerConfig {reuse_query_fragments, ..Default::default()},
Subgraph1: r#"
const SUBGRAPH: &str = r#"
type Query {
t: T
}
Expand All @@ -322,9 +304,9 @@ fn respects_query_planner_option_reuse_query_fragments(reuse_query_fragments: bo
x: Int
y: Int
}
"#,
);
let query = r#"
"#;

const QUERY: &str = r#"
query {
t {
a1 {
Expand All @@ -340,12 +322,21 @@ fn respects_query_planner_option_reuse_query_fragments(reuse_query_fragments: bo
x
y
}
"#;
if reuse_query_fragments {
assert_plan!(
&planner,
query,
@r#"
"#;

#[test]
#[should_panic(expected = "not yet implemented")]
// TODO: investigate this failure

fn respects_query_planner_option_reuse_query_fragments_true() {
let planner = planner!(
config = QueryPlannerConfig { reuse_query_fragments: true, ..Default::default()},
Subgraph1: SUBGRAPH,
);
assert_plan!(
&planner,
QUERY,
@r#"
QueryPlan {
Fetch(service: "Subgraph1") {
{
Expand All @@ -365,13 +356,23 @@ fn respects_query_planner_option_reuse_query_fragments(reuse_query_fragments: bo
}
},
}
"#
);
} else {
assert_plan!(
&planner,
query,
@r#"
"#
);
}

#[test]
#[should_panic(expected = "not yet implemented")]
// TODO: investigate this failure

fn respects_query_planner_option_reuse_query_fragments_false() {
let planner = planner!(
config = QueryPlannerConfig { reuse_query_fragments: false, ..Default::default()},
Subgraph1: SUBGRAPH,
);
assert_plan!(
&planner,
QUERY,
@r#"
QueryPlan {
Fetch(service: "Subgraph1") {
{
Expand All @@ -388,9 +389,8 @@ fn respects_query_planner_option_reuse_query_fragments(reuse_query_fragments: bo
}
},
}
"#
);
}
"#
);
}

#[test]
Expand Down Expand Up @@ -464,7 +464,7 @@ fn it_works_with_nested_fragments_when_only_the_nested_fragment_gets_preserved()

#[test]
#[should_panic(
expected = "Error: variable `$if` of type `Boolean` cannot be used for argument `if` of type `Boolean!`"
expected = "variable `$if` of type `Boolean` cannot be used for argument `if` of type `Boolean!`"
)]
// TODO: investigate this failure
fn it_preserves_directives_when_fragment_not_used() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Composed from subgraphs with hash: 4b0a2b41b9cbccb8bde234dc0285c3372e220fa1
# Composed from subgraphs with hash: ca8bc5b745ab72ecb5d72159ed30d089d2084d77
schema
@link(url: "https://specs.apollo.dev/link/v1.0")
@link(url: "https://specs.apollo.dev/join/v0.3", for: EXECUTION)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Composed from subgraphs with hash: ca8bc5b745ab72ecb5d72159ed30d089d2084d77
schema
@link(url: "https://specs.apollo.dev/link/v1.0")
@link(url: "https://specs.apollo.dev/join/v0.3", for: EXECUTION)
{
query: Query
}

directive @join__enumValue(graph: join__Graph!) repeatable on ENUM_VALUE

directive @join__field(graph: join__Graph, requires: join__FieldSet, provides: join__FieldSet, type: String, external: Boolean, override: String, usedOverridden: Boolean) repeatable on FIELD_DEFINITION | INPUT_FIELD_DEFINITION

directive @join__graph(name: String!, url: String!) on ENUM_VALUE

directive @join__implements(graph: join__Graph!, interface: String!) repeatable on OBJECT | INTERFACE

directive @join__type(graph: join__Graph!, key: join__FieldSet, extension: Boolean! = false, resolvable: Boolean! = true, isInterfaceObject: Boolean! = false) repeatable on OBJECT | INTERFACE | UNION | ENUM | INPUT_OBJECT | SCALAR

directive @join__unionMember(graph: join__Graph!, member: String!) repeatable on UNION

directive @link(url: String, as: String, for: link__Purpose, import: [link__Import]) repeatable on SCHEMA

type A
@join__type(graph: SUBGRAPH1)
{
x: Int
y: Int
}

scalar join__FieldSet

enum join__Graph {
SUBGRAPH1 @join__graph(name: "Subgraph1", url: "none")
}

scalar link__Import

enum link__Purpose {
"""
`SECURITY` features provide metadata necessary to securely resolve fields.
"""
SECURITY

"""
`EXECUTION` features provide metadata necessary for operation execution.
"""
EXECUTION
}

type Query
@join__type(graph: SUBGRAPH1)
{
t: T
}

type T
@join__type(graph: SUBGRAPH1)
{
a1: A
a2: A
}
Loading