[Cosmos] Integration tests for items and query #1963
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 inasync 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 changedazure_core_test::recorded::start
to returnResult<Option<Session>>
(instead of justResult<Session>
). If the test is running in live mode, it'll returnOk(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.