Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
44c9afd
Initial framework for describing test matrix
FabianMeiswinkel Sep 8, 2026
15ee860
Change what json files capture vs. source code
FabianMeiswinkel Sep 10, 2026
ffcd2fd
Merge remote-tracking branch 'origin/main' into users/fabianm/E2ETests
FabianMeiswinkel Sep 10, 2026
c25f571
Formatting fixes
FabianMeiswinkel Sep 10, 2026
40c9808
Refactored test cases for better readability
FabianMeiswinkel Sep 10, 2026
9582713
Reacting to code review comments
FabianMeiswinkel Sep 11, 2026
7688360
Addressing Code review feedback
FabianMeiswinkel Sep 11, 2026
aba0f5d
Update catalog.rs
FabianMeiswinkel Sep 11, 2026
401fa86
Applying code review feedback
FabianMeiswinkel Sep 11, 2026
7f025d5
Apply code review feedback
FabianMeiswinkel Sep 11, 2026
35c02bd
Applying formatting
FabianMeiswinkel Sep 11, 2026
2eeb5f1
Add spec
FabianMeiswinkel Sep 11, 2026
64259e2
Reacting to code review feedback
FabianMeiswinkel Sep 11, 2026
db94ade
Revert eng/* changes to test execution script
FabianMeiswinkel Sep 12, 2026
d3d9989
Merge branch 'main' of https://github.com/Azure/azure-sdk-for-rust in…
FabianMeiswinkel Sep 12, 2026
d11c39c
Addressing code review feedback
FabianMeiswinkel Sep 12, 2026
e849d65
Fix session token capturing being also gated on session consistency
FabianMeiswinkel Sep 13, 2026
2954d3a
Fix test flakiness
FabianMeiswinkel Sep 13, 2026
f25504d
Fix test failures
FabianMeiswinkel Sep 13, 2026
20161e7
Addressing code review comments
FabianMeiswinkel Sep 15, 2026
eb872b4
Addressed code review feedback
FabianMeiswinkel Sep 17, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion sdk/cosmos/azure_data_cosmos/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ tokio = { workspace = true, features = [
"test-util",
] }
tracing-subscriber = { workspace = true, features = ["env-filter", "fmt"] }
uuid = { workspace = true, features = ["v4", "fast-rng"] }
uuid = { workspace = true, features = ["v4", "v7", "fast-rng"] }

[lints]
workspace = true
Expand Down Expand Up @@ -170,6 +170,11 @@ name = "in_memory_emulator"
path = "tests/in_memory_emulator.rs"
required-features = ["__internal_in_memory_emulator"]

[[test]]
name = "e2e_tests"
path = "tests/e2e_tests.rs"
required-features = ["key_auth", "control_plane"]

# The `cosmos` example CLI exercises control-plane operations (database and
# container CRUD, throughput) alongside data-plane commands, so the whole
# binary requires the `control_plane` feature to compile.
Expand Down
2 changes: 1 addition & 1 deletion sdk/cosmos/azure_data_cosmos/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
fn main() {
// Allow `#[cfg_attr(not(test_category = "..."), ignore)]` in `tests/*.rs`.
println!(
"cargo:rustc-check-cfg=cfg(test_category, values(\"emulator\", \"emulator_vnext\", \"emulator_inmemory\", \"emulator_inmemory_gateway_v2\", \"multi_write\", \"split\", \"merge\", \"binary_encoding\", \"gateway_v2\", \"gateway_v2_multi_region\"))"
"cargo:rustc-check-cfg=cfg(test_category, values(\"emulator\", \"emulator_vnext\", \"emulator_inmemory\", \"emulator_inmemory_gateway_v2\", \"e2e\", \"multi_write\", \"split\", \"merge\", \"binary_encoding\", \"gateway_v2\", \"gateway_v2_multi_region\"))"
);
// Marker cfg set by test setups where the target Cosmos account is provisioned
// for AAD data-plane access (local emulator started with /enableaadauthentication,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

use azure_core::http::StatusCode;

use crate::e2e_test_cases::{
fixture::{build_client, TestResult},
support::should_run,
};

#[tokio::test]
#[cfg_attr(
not(any(test_category = "emulator_inmemory", test_category = "e2e")),
ignore = "requires the externally hosted in-memory emulator"
)]
async fn bootstrap_primary_endpoint() -> TestResult {
if !should_run("bootstrap.primary-success").await? {
return Ok(());
}

// Building the public SDK client against the reachable primary endpoint succeeds.
let client = build_client().await?;

// The initialized client can complete its first account operation.
let database_id = format!("e2e-bootstrap-{}", azure_core::Uuid::new_v4());
let response = client.create_database(&database_id, None).await?;
assert_eq!(response.status().status_code(), StatusCode::Created);
response.into_model()?;

// Remove the resource created only to prove successful bootstrap.
client.database_client(&database_id).delete(None).await?;
Ok(())
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

use serde::Deserialize;

use crate::e2e_test_cases::{fixture::TestResult, support::should_run};

#[tokio::test]
#[cfg_attr(
not(any(test_category = "emulator_inmemory", test_category = "e2e")),
ignore = "requires the externally hosted in-memory emulator"
)]
async fn capability_document_is_versioned() -> TestResult {
if !should_run("management.capabilities").await? {
return Ok(());
}

// Read the emulator's public management document without using Rust internals.
let management_endpoint = std::env::var("AZURE_COSMOS_INMEMORY_MANAGEMENT_ENDPOINT")?;
let response = reqwest::Client::new()
.get(url::Url::parse(&management_endpoint)?.join("capabilities")?)
.send()
.await?;
assert_eq!(response.status(), reqwest::StatusCode::OK);
let capabilities: CapabilityDocument = serde_json::from_slice(&response.bytes().await?)?;

// The document is versioned and advertises the minimum E2E orchestration surface.
assert_eq!(capabilities.api_version, 1);
assert!(!capabilities.emulator_version.is_empty());
assert!(capabilities.protocols.gateway_v1);
assert!(capabilities.data_plane.iter().any(|value| value == "item"));
assert!(capabilities
.management_actions
.iter()
.any(|value| value == "partitionSplit"));

// Gateway V2 advertisement follows the emulator flavor selected by the profile matrix.
let expects_v2 = std::env::var("AZURE_COSMOS_EMULATOR_FLAVOR").as_deref() == Ok("inmemory-v2");
assert_eq!(capabilities.protocols.gateway_v2, expects_v2);
Ok(())
}

#[derive(Deserialize)]
#[serde(rename_all = "camelCase")]
struct CapabilityDocument {
api_version: u32,
emulator_version: String,
protocols: ProtocolCapabilities,
data_plane: Vec<String>,
management_actions: Vec<String>,
}

#[derive(Deserialize)]
#[serde(rename_all = "camelCase")]
struct ProtocolCapabilities {
gateway_v1: bool,
gateway_v2: bool,
}
Loading
Loading