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

test query request with one variable set #69

Merged
merged 3 commits into from
May 1, 2024

Conversation

hallettj
Copy link
Collaborator

@hallettj hallettj commented Apr 30, 2024

Describe your changes

Add a test just to make sure this case works. I thought I remembered MongoDB rejecting $facet stages with only one sub-pipeline, but according to this test that case works just fine in MongoDB versions 5, 6, and 7.

This PR expands the integration tests to allow sending a query request directly to a connector, bypassing the engine. It also cleans up some of the test helper code. The test snapshots all needed to be updated because I changed a function name, which changed the expression used to produce snapshot results, and the expression is captured as part of the snapshot file.

Issue ticket number and link

MDB-135

@hallettj hallettj self-assigned this Apr 30, 2024
Comment on lines 30 to 46
#[tokio::test]
async fn handles_request_with_single_variable_set() -> anyhow::Result<()> {
assert_yaml_snapshot!({
run_connector_query(
query_request()
.collection("movies")
.variables([vec![("id", json!("573a1390f29313caabcd50e5"))]])
.query(
query()
.predicate(equal(target!("_id"), variable!(id)))
.fields([field!("title")]),
),
)
.await?
});
Ok(())
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is the new test

Comment on lines +1 to +6
---
source: crates/integration-tests/src/tests/remote_relationship.rs
expression: "{\n run_connector_query(query_request().collection(\"movies\").variables([vec![(\"id\",\n json!(\"573a1390f29313caabcd50e5\"))]]).query(query().predicate(equal(target!(\"_id\"),\n variable!(id))).fields([field!(\"title\")]))).await?\n}"
---
- rows:
- title: Gertie the Dinosaur
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is the snapshot of the result of the new test

@hallettj hallettj merged commit e273146 into main May 1, 2024
1 check passed
@hallettj hallettj deleted the jesse/fix-single-variable-set branch May 1, 2024 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants