graphql-engine/v3/crates/engine/tests/explain.rs
Samir Talwar 5a0102b407 Avoid .unwrap in favor of anyhow for better error messages in tests. (#430)
I am struggling to diagnose some errors and `.unwrap` is not helping, as
it doesn't properly capture stack traces or anything else that might be
useful.

`anyhow` was built for this. Let's use it.

I had to convert `SessionError` to a real `Error`, which I don't think
is a bad thing.

V3_GIT_ORIGIN_REV_ID: 3b8a70bb87e12e7b9e39515cd5f769fbd2cbfb39
2024-04-02 17:06:56 +00:00

66 lines
2.0 KiB
Rust

#[allow(dead_code)]
mod common;
#[test]
fn test_explain_introspection() -> anyhow::Result<()> {
common::test_execute_explain(
"explain/introspection_query",
"explain/introspection_query/metadata.json",
&[],
)
}
#[test]
fn test_multi_root_field_queries() -> anyhow::Result<()> {
common::test_execute_explain(
"explain/multi_root_field_queries",
"execute/multiple_root_fields/successful_execution/metadata.json",
&[],
)
}
#[test]
fn test_field_with_remote_relationship() -> anyhow::Result<()> {
common::test_execute_explain(
"explain/field_with_remote_relationship",
"execute/remote_relationships/array/metadata.json",
&["execute/common_metadata/two_postgres_connector_schema.json"],
)
}
#[test]
fn test_field_with_local_relationship() -> anyhow::Result<()> {
common::test_execute_explain(
"explain/field_with_local_relationship",
"execute/relationships/array/metadata.json",
&["execute/common_metadata/postgres_connector_schema.json"],
)
}
#[test]
fn test_field_with_multi_remote_relationship_subfields() -> anyhow::Result<()> {
common::test_execute_explain(
"explain/field_with_multi_remote_relationship_subfields",
"explain/field_with_multi_remote_relationship_subfields/metadata.json",
&["execute/common_metadata/two_postgres_connector_schema.json"],
)
}
#[test]
fn test_field_with_nested_remote_relationship_1() -> anyhow::Result<()> {
common::test_execute_explain(
"explain/field_with_nested_remote_relationship_1",
"explain/field_with_nested_remote_relationship_1/metadata.json",
&["execute/common_metadata/two_postgres_connector_schema.json"],
)
}
#[test]
fn test_field_with_nested_remote_relationship_2() -> anyhow::Result<()> {
common::test_execute_explain(
"explain/field_with_nested_remote_relationship_2",
"explain/field_with_nested_remote_relationship_2/metadata.json",
&["execute/common_metadata/two_postgres_connector_schema.json"],
)
}