Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
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
11 changes: 9 additions & 2 deletions .github/workflows/dotnet-build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ jobs:
pull-requests: read
outputs:
dotnetChanges: ${{ steps.filter.outputs.dotnet}}
cosmosDbChanges: ${{ steps.filter.outputs.cosmosdb}}
steps:
- uses: actions/checkout@v6
- uses: dorny/paths-filter@v3
Expand All @@ -44,10 +45,15 @@ jobs:
filters: |
dotnet:
- 'dotnet/**'
cosmosdb:
- 'dotnet/src/Microsoft.Agents.AI.CosmosNoSql/**'
# run only if 'dotnet' files were changed
- name: dotnet tests
if: steps.filter.outputs.dotnet == 'true'
run: echo "Dotnet file"
- name: dotnet CosmosDB tests
if: steps.filter.outputs.cosmosdb == 'true'
run: echo "Dotnet CosmosDB changes"
# run only if not 'dotnet' files were changed
- name: not dotnet tests
if: steps.filter.outputs.dotnet != 'true'
Expand Down Expand Up @@ -124,9 +130,9 @@ jobs:
popd
rm -rf "$TEMP_DIR"

# Start Cosmos DB Emulator for Cosmos-based unit tests (only on Windows)
# Start Cosmos DB Emulator for Cosmos-based unit tests (only when CosmosDB changes happened and running on Windows OS)
- name: Start Azure Cosmos DB Emulator
if: runner.os == 'Windows'
if: runner.os == 'Windows' && needs.paths-filter.outputs.cosmosDbChanges == 'true'
shell: pwsh
run: |
Write-Host "Launching Azure Cosmos DB Emulator"
Expand Down Expand Up @@ -196,6 +202,7 @@ jobs:
done
env:
# Cosmos DB Emulator connection settings
COSMOS_EMULATOR_AVAILABLE: true
Comment thread
rogerbarreto marked this conversation as resolved.
Outdated
COSMOSDB_ENDPOINT: https://localhost:8081
COSMOSDB_KEY: C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==
# OpenAI Models
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,9 +217,7 @@ protected virtual void Dispose(bool disposing)
}
}

/// <summary>
/// Represents a checkpoint document stored in Cosmos DB.
/// </summary>
/// <summary>Represents a checkpoint document stored in Cosmos DB.</summary>
internal sealed class CosmosCheckpointDocument
{
[JsonProperty("id")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
using Azure.Identity;
using Microsoft.Azure.Cosmos;
using Microsoft.Extensions.AI;
using Xunit;

namespace Microsoft.Agents.AI.CosmosNoSql.UnitTests;

Expand Down Expand Up @@ -59,6 +58,9 @@ public sealed class CosmosChatMessageStoreTests : IAsyncLifetime, IDisposable

public async Task InitializeAsync()
{
// Fail fast if emulator is not available
this.SkipIfEmulatorNotAvailable();

// Check environment variable to determine if we should preserve containers
// Set COSMOS_PRESERVE_CONTAINERS=true to keep containers and data for inspection
this._preserveContainer = string.Equals(Environment.GetEnvironmentVariable("COSMOS_PRESERVE_CONTAINERS"), "true", StringComparison.OrdinalIgnoreCase);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
using Microsoft.Agents.AI.Workflows;
using Microsoft.Agents.AI.Workflows.Checkpointing;
using Microsoft.Azure.Cosmos;
using Xunit;

namespace Microsoft.Agents.AI.CosmosNoSql.UnitTests;

Expand Down Expand Up @@ -58,6 +57,9 @@ private static JsonSerializerOptions CreateJsonOptions()

public async Task InitializeAsync()
{
// Fail fast if emulator is not available
this.SkipIfEmulatorNotAvailable();

// Check environment variable to determine if we should preserve containers
// Set COSMOS_PRESERVE_CONTAINERS=true to keep containers and data for inspection
this._preserveContainer = string.Equals(Environment.GetEnvironmentVariable("COSMOS_PRESERVE_CONTAINERS"), "true", StringComparison.OrdinalIgnoreCase);
Expand Down
Loading