E2E certification tests - PR1 - #5277
Fabian Meiswinkel (FabianMeiswinkel) wants to merge 20 commits into
Conversation
|
Azure Pipelines: Successfully started running 1 pipeline(s). 2 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
One matrix references nonexistent profiles, and consistency tests can pass without proving their intended transient behavior.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review tier: Balanced
Findings: 3
New issues introduced by this change (3)
| Severity | Finding |
|---|---|
sdk/cosmos/azure_data_cosmos/tests/e2e_test_cases/catalog.rs — Catalog validation is not exhaustive because the scenario inventory is hard-coded. A new JSON… |
|
sdk/cosmos/azure_data_cosmos/tests/e2e_test_cases/item_lifecycle.rs — The delayed consistency cases can pass without exercising the behavior they are intended to… |
|
sdk/cosmos/e2e-profile-matrix.json — These values cannot be consumed by the new setup path: New-CosmosE2eEmulatorConfig resolves each… |
What changed in this PR
Introduces a metadata-driven Cosmos DB E2E testing framework using the public Rust SDK and hosted emulator.
Changes:
- Adds scenario/profile schemas, metadata, and Rust implementations.
- Adds emulator capability discovery and profile-driven setup.
- Adds Gateway V1/V2 CI matrices for consistency testing.
| File | Description |
|---|---|
sdk/cosmos/eng/scripts/Invoke-CosmosTestSetup.ps1 |
Validates metadata and generates emulator configs. |
sdk/cosmos/e2e-read-consistency-override-matrix.json |
Defines read-consistency override jobs. |
sdk/cosmos/e2e-profile-matrix.json |
Defines a currently invalid profile matrix. |
sdk/cosmos/e2e-consistency-matrix.json |
Defines account-consistency jobs. |
sdk/cosmos/e2e_tests/schema/scenario.v1.json |
Defines scenario metadata schema. |
sdk/cosmos/e2e_tests/schema/profile.v1.json |
Defines setup-profile schema. |
sdk/cosmos/e2e_tests/scenarios/queries/parameterized-filter.json |
Catalogs parameterized query coverage. |
sdk/cosmos/e2e_tests/scenarios/queries/invalid-syntax.json |
Catalogs invalid-query coverage. |
sdk/cosmos/e2e_tests/scenarios/management/capabilities.json |
Catalogs capability discovery. |
sdk/cosmos/e2e_tests/scenarios/items/upsert-create-update.json |
Catalogs upsert behavior. |
sdk/cosmos/e2e_tests/scenarios/items/optimistic-concurrency.json |
Catalogs ETag concurrency behavior. |
sdk/cosmos/e2e_tests/scenarios/items/not-found-wrong-partition-key.json |
Catalogs not-found behavior. |
sdk/cosmos/e2e_tests/scenarios/items/lifecycle.json |
Catalogs item lifecycle behavior. |
sdk/cosmos/e2e_tests/scenarios/items/create-conflict.json |
Catalogs duplicate-create behavior. |
sdk/cosmos/e2e_tests/scenarios/diagnostics/success-and-error.json |
Catalogs diagnostics coverage. |
sdk/cosmos/e2e_tests/scenarios/bootstrap/primary-success.json |
Catalogs client bootstrap behavior. |
sdk/cosmos/e2e_tests/README.md |
Documents the E2E framework. |
sdk/cosmos/e2e_tests/profiles/targetDefault.json |
Adds a target-default profile. |
sdk/cosmos/e2e_tests/profiles/readConsistencyOverrideMatrix.json |
Adds override combinations. |
sdk/cosmos/e2e_tests/profiles/lifecycleConsistencyMatrix.json |
Adds consistency configurations. |
sdk/cosmos/e2e_tests/profiles/legacyGatewayV1.json |
Adds a Gateway V1 profile. |
sdk/cosmos/e2e_tests/profiles/hostedEmulatorSmoke.json |
Adds the smoke-test profile. |
sdk/cosmos/e2e_tests/implementations/rust.json |
Maps scenarios to Rust tests. |
sdk/cosmos/ci.yml |
Schedules extended E2E matrices. |
sdk/cosmos/azure_data_cosmos/tests/e2e_tests.rs |
Registers the E2E test target. |
sdk/cosmos/azure_data_cosmos/tests/e2e_test_cases/support.rs |
Adds shared test helpers. |
sdk/cosmos/azure_data_cosmos/tests/e2e_test_cases/query_parameterized_filter.rs |
Tests parameterized queries. |
sdk/cosmos/azure_data_cosmos/tests/e2e_test_cases/query_invalid_syntax.rs |
Tests invalid query errors. |
sdk/cosmos/azure_data_cosmos/tests/e2e_test_cases/mod.rs |
Registers E2E modules and tests. |
sdk/cosmos/azure_data_cosmos/tests/e2e_test_cases/item_upsert.rs |
Tests upsert semantics. |
sdk/cosmos/azure_data_cosmos/tests/e2e_test_cases/item_optimistic_concurrency.rs |
Tests stale ETag rejection. |
sdk/cosmos/azure_data_cosmos/tests/e2e_test_cases/item_not_found.rs |
Tests partition-key isolation. |
sdk/cosmos/azure_data_cosmos/tests/e2e_test_cases/item_lifecycle.rs |
Tests lifecycle consistency matrices. |
sdk/cosmos/azure_data_cosmos/tests/e2e_test_cases/item_create_conflict.rs |
Tests conflicts across key types. |
sdk/cosmos/azure_data_cosmos/tests/e2e_test_cases/fixture.rs |
Adds reusable resource fixtures. |
sdk/cosmos/azure_data_cosmos/tests/e2e_test_cases/diagnostics_success_and_error.rs |
Tests public diagnostics. |
sdk/cosmos/azure_data_cosmos/tests/e2e_test_cases/catalog.rs |
Validates catalog relationships. |
sdk/cosmos/azure_data_cosmos/tests/e2e_test_cases/capabilities.rs |
Tests capability discovery. |
sdk/cosmos/azure_data_cosmos/tests/e2e_test_cases/bootstrap_primary.rs |
Tests primary endpoint bootstrap. |
sdk/cosmos/azure_data_cosmos/Cargo.toml |
Registers the E2E integration target. |
sdk/cosmos/azure_data_cosmos/build.rs |
Allows the e2e test category. |
sdk/cosmos/azure_data_cosmos_emulator/src/management.rs |
Adds the capabilities endpoint. |
sdk/cosmos/azure_data_cosmos_emulator/README.md |
Documents capability discovery. |
sdk/cosmos/azure_data_cosmos_driver/src/options/read_consistency.rs |
Clarifies regional consistency semantics. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
…to users/fabianm/E2ETests_PR1 # Conflicts: # sdk/cosmos/azure_data_cosmos/build.rs
|
/azp run rust - cosmos - weekly |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
|
/azp run rust - cosmos - weekly |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
|
Azure Pipelines: Successfully started running 1 pipeline(s). 2 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Ashley Stanton-Nurse (analogrelay)
left a comment
There was a problem hiding this comment.
Haven't dug through the implementations yet, but the infrastructure looks sound. If others approve the implementations, go ahead and merge, I'll try to review them myself in a bit though.
Ashley Stanton-Nurse (analogrelay)
left a comment
There was a problem hiding this comment.
Nothing critical, and it can all be addressed in follow-up PRs if you want to avoid churn on this one.
| pub async fn run<F>(test: F) -> TestResult | ||
| where | ||
| F: AsyncFnOnce(&E2eTestFixture) -> TestResult, | ||
| { | ||
| Self::run_with_partition_key("/pk".into(), test).await | ||
| } | ||
|
|
||
| pub async fn run_with_partition_key<F>( | ||
| partition_key: PartitionKeyDefinition, | ||
| test: F, | ||
| ) -> TestResult | ||
| where | ||
| F: AsyncFnOnce(&E2eTestFixture) -> TestResult, | ||
| { | ||
| let client = build_client().await?; | ||
| Self::run_with_client(client, partition_key, test).await | ||
| } | ||
|
|
||
| pub async fn run_with_client<F>( | ||
| client: CosmosClient, | ||
| partition_key: PartitionKeyDefinition, | ||
| test: F, | ||
| ) -> TestResult |
There was a problem hiding this comment.
How about a builder pattern?
E2eTest::builder()
.with_partition_key_definition(...)
.run(|f| {
});That avoids the ever-expanding run_... constructors.
There was a problem hiding this comment.
Good idea for readability,
| } | ||
| } | ||
|
|
||
| fn read_cases_for_account_consistency(account: &AccountDefinition) -> Vec<PostCreateReadCase> { |
There was a problem hiding this comment.
I'm not 100% sure this reads better than just having separate test-case functions with ample use of helpers. This requires reading and understanding the cases, understanding all the setup and verification helpers to know what they do with these enum values, and then finally reading the test itself. Having each case be a literal test function, but one that leverages a few very common helpers for truly common behaviour (critically, the test function contains the logic that handles session tokens, or checks if the read succeeds immediately, etc.
Not blocking on this, but it would be a refactor towards clarity IMO. I'd actually prefer more lines of code here if they made it easier to review individual cases in isolation.
There was a problem hiding this comment.
Agreed - ultimately main "quality" for source code of tests is readability
My concerns have been addressed and all source is under sdk/cosmos now.

Summary
Introduces the foundation for functional Cosmos DB Rust SDK E2E testing through the public
azure_data_cosmosAPI.PR1 scope
Follow-up PRs