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

[Cosmos] Integration tests for items and query #1963

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

analogrelay
Copy link
Member

This PR adds integration tests for Item CRUD and Item Query to the Cosmos crate, somewhat inspired by the emulator_cosmos_item_test and emulator_cosmos_query_test.

I did want to break down some of the operations to their own tests though, unlike the Go SDK which has a bundle of "CRUD" tests in one test. We can always pivot to that if necessary for test performance, etc.

In addition, I changed our doc examples to use ? syntax (by having them be in async fn doc() -> Result<(), Box<dyn std::error::Error>> wrapper functions). It looks a lot cleaner that way, IMO, by removing all the noisy .unwrap() calls and matching more closely to what we expect users to do in their own applications.

Finally, I did need one change in the azure_core_test crate, because our live tests were broken by #1956 . I changed azure_core_test::recorded::start to return Result<Option<Session>> (instead of just Result<Session>). If the test is running in live mode, it'll return Ok(None), to indicate that no test proxy session was established. I think this is the right way to handle this, but I'm open to feedback.

I'm not expecting action on this until the new year, because I know @heaths is out until the new year and the azure_core_test change will need his ✅ , but I wanted to open it up and get Cosmos folks looking at it.

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.

1 participant