-
Notifications
You must be signed in to change notification settings - Fork 950
.NET: Cosmos DB UT Fast Skip (For Non-Configured Local envs) #2906
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
Conversation
…skip in pipeline when no CosmosDB changes happened
There was a problem hiding this comment.
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 implements fast-fail behavior for Cosmos DB unit tests when the emulator is not available and optimizes CI pipeline execution by conditionally starting the Cosmos DB emulator only when CosmosDB-related code changes are detected.
Key changes:
- Added
SkipIfEmulatorNotAvailable()calls in test initialization to enable fast skipping when the emulator is not configured - Introduced path filtering for CosmosDB changes to conditionally start the emulator in CI pipelines
- Added
COSMOS_EMULATOR_AVAILABLEenvironment variable to signal emulator availability to tests
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| dotnet/tests/Microsoft.Agents.AI.CosmosNoSql.UnitTests/CosmosCheckpointStoreTests.cs | Added fast-skip check in InitializeAsync() and removed unnecessary using Xunit; statement |
| dotnet/tests/Microsoft.Agents.AI.CosmosNoSql.UnitTests/CosmosChatMessageStoreTests.cs | Added fast-skip check in InitializeAsync() and removed unnecessary using Xunit; statement |
| .github/workflows/dotnet-build-and-test.yml | Added CosmosDB path filter, conditional emulator startup, and COSMOS_EMULATOR_AVAILABLE environment variable configuration |
Motivation and Context
Cosmos DB Unit Tests do not fail fast when the environment is not configured.
This change solves this making the whole project skip at once for non-configured environments.
This change also skip Emulator running in every single pipeline when no CosmosDB code related was changed, improving execution the time.