Skip to content

Refresh Cosmos recorded test assets - #3351

Open
Chidozie Ononiwu (chidozieononiwu) wants to merge 2 commits into
microsoft:mainfrom
chidozieononiwu:flakyCosmosTests
Open

Refresh Cosmos recorded test assets#3351
Chidozie Ononiwu (chidozieononiwu) wants to merge 2 commits into
microsoft:mainfrom
chidozieononiwu:flakyCosmosTests

Conversation

@chidozieononiwu

@chidozieononiwu Chidozie Ononiwu (chidozieononiwu) commented Aug 22, 2026

Copy link
Copy Markdown
Member

This pull request primarily refactors the Cosmos client creation flow in CosmosService by removing the explicit validation step, and updates related test comments for clarity. It also increases the timeout for reading JSON-RPC responses in a test and updates a test asset tag.

Cosmos client creation and validation:

  • Removed the ValidateCosmosClientAsync method and the call to it in CreateCosmosClientWithAuth, so the client is no longer validated with a lightweight operation immediately after creation. This simplifies the client initialization process. [1] [2]

Test updates and clarifications:

  • Updated comments in several tests in CosmosServiceTests.cs to clarify that failures occur during database operations, not during client validation or creation. [1] [2] [3] [4]
  • Increased the timeout for reading a JSON-RPC response from 10 to 30 seconds in ConsolidatedMode_Should_Interop_With_Legacy_Initialize_Handsha to reduce test flakiness.

Test asset update:

  • Updated the test asset tag in assets.json to a new value.This pull request makes a minor update to the test assets configuration by changing the Tag value in the assets.json file. This typically reflects a new version or state of the assets used for testing.

  • Updated the Tag field in assets.json to Azure.Mcp.Tools.Cosmos.Tests_241ef3d966 to reference the latest asset version.

#3315

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI lite review requested due to automatic review settings August 25, 2026 20:58

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR refreshes Cosmos recorded-test asset references and adjusts Cosmos/test behaviors to reduce failures during credential/key auth scenarios and flaky integration-style test interactions.

Changes:

  • Updated Cosmos test assets.json Tag to point at the latest azure-sdk-assets snapshot.
  • Removed the Cosmos client “validation” call (ReadAccountAsync) during client creation, shifting auth failures to the first real database operation.
  • Increased the JSON-RPC response read timeout in consolidated-mode server tests (10s → 30s) to reduce flakiness.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
tools/Azure.Mcp.Tools.Cosmos/tests/Azure.Mcp.Tools.Cosmos.Tests/CosmosServiceTests.cs Updates test comments to match the new behavior (failures occur during database operations, not client validation).
tools/Azure.Mcp.Tools.Cosmos/tests/Azure.Mcp.Tools.Cosmos.Tests/assets.json Bumps recorded-test assets Tag to a newer snapshot.
tools/Azure.Mcp.Tools.Cosmos/src/Services/CosmosService.cs Removes the lightweight client validation (ReadAccountAsync) during Cosmos client creation.
servers/Azure.Mcp.Server/tests/Azure.Mcp.Server.Tests/Infrastructure/ConsolidatedModeTests.cs Extends the read timeout used when awaiting JSON-RPC responses to reduce test flakiness.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread tools/Azure.Mcp.Tools.Cosmos/src/Services/CosmosService.cs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants