From 18801e1e7b7115322752fc42befab84fcb4fb06c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 23 Jul 2025 04:00:17 +0000 Subject: [PATCH 1/4] Initial plan From 985fd788a7c9d60f7cad23a06f2fdbd154f8db41 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 23 Jul 2025 04:08:13 +0000 Subject: [PATCH 2/4] Add Linux workflow for testing with Cosmos DB emulator docker container Co-authored-by: philnach <19275540+philnach@users.noreply.github.com> --- .../workflows/linux-cosmos-emulator-test.yml | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 .github/workflows/linux-cosmos-emulator-test.yml diff --git a/.github/workflows/linux-cosmos-emulator-test.yml b/.github/workflows/linux-cosmos-emulator-test.yml new file mode 100644 index 0000000..cfdceb8 --- /dev/null +++ b/.github/workflows/linux-cosmos-emulator-test.yml @@ -0,0 +1,63 @@ +name: Linux .NET test with Cosmos DB Emulator +on: + workflow_dispatch: + pull_request: + branches: [ "main" ] + paths: + - 'Extensions/Cosmos/**' + - '.github/workflows/linux-cosmos-emulator-test.yml' + +jobs: + cosmos_tests_linux: + name: Run Cosmos .NET unit tests on Linux + runs-on: ubuntu-latest + services: + cosmos-emulator: + image: mcr.microsoft.com/cosmosdb/linux/azure-cosmos-emulator:latest + ports: + - 8081:8081 + - 10251:10251 + - 10252:10252 + - 10253:10253 + - 10254:10254 + env: + AZURE_COSMOS_EMULATOR_PARTITION_COUNT: 10 + AZURE_COSMOS_EMULATOR_ENABLE_DATA_PERSISTENCE: false + AZURE_COSMOS_EMULATOR_IP_ADDRESS_OVERRIDE: 127.0.0.1 + options: >- + --health-cmd="curl -f -k https://127.0.0.1:8081/_explorer/emulator.pem || exit 1" + --health-interval=30s + --health-timeout=10s + --health-retries=10 + steps: + - name: Checkout (GitHub) + uses: actions/checkout@v4 + + - name: Setup .NET + uses: actions/setup-dotnet@v3 + with: + dotnet-version: 8.0.x + + - name: Restore dependencies + run: dotnet restore + + - name: Build + run: dotnet build --no-restore + + - name: Wait for Cosmos Emulator + run: | + echo "Waiting for Cosmos DB Emulator to be ready..." + timeout 300 bash -c 'until curl -f -k https://127.0.0.1:8081/_explorer/emulator.pem; do sleep 5; done' + echo "Cosmos DB Emulator is ready!" + + - name: Import Cosmos Emulator Certificate + run: | + curl -k https://127.0.0.1:8081/_explorer/emulator.pem > ~/emulatorcert.crt + sudo cp ~/emulatorcert.crt /usr/local/share/ca-certificates/ + sudo update-ca-certificates + + - name: Run Cosmos Extension Tests + run: dotnet test ./Extensions/Cosmos/Cosmos.DataTransfer.CosmosExtension.UnitTests/ --no-build --verbosity normal + env: + Cosmos_Endpoint: https://127.0.0.1:8081/ + Cosmos_Key: C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw== \ No newline at end of file From e0e0e81d6caf2a2bc1a18d6a2e31799e9fcfd694 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 23 Jul 2025 04:10:50 +0000 Subject: [PATCH 3/4] Enhance Linux Cosmos DB emulator workflow with better logging and connectivity checks Co-authored-by: philnach <19275540+philnach@users.noreply.github.com> --- .github/workflows/linux-cosmos-emulator-test.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/linux-cosmos-emulator-test.yml b/.github/workflows/linux-cosmos-emulator-test.yml index cfdceb8..f20bcac 100644 --- a/.github/workflows/linux-cosmos-emulator-test.yml +++ b/.github/workflows/linux-cosmos-emulator-test.yml @@ -57,7 +57,12 @@ jobs: sudo update-ca-certificates - name: Run Cosmos Extension Tests - run: dotnet test ./Extensions/Cosmos/Cosmos.DataTransfer.CosmosExtension.UnitTests/ --no-build --verbosity normal + run: | + echo "Running Cosmos extension unit tests with emulator connection..." + echo "Cosmos_Endpoint: $Cosmos_Endpoint" + echo "Testing connectivity to emulator..." + curl -k -s https://127.0.0.1:8081/_explorer/index.html > /dev/null && echo "Emulator is responding" || echo "Warning: Emulator may not be fully ready" + dotnet test ./Extensions/Cosmos/Cosmos.DataTransfer.CosmosExtension.UnitTests/ --no-build --verbosity normal env: Cosmos_Endpoint: https://127.0.0.1:8081/ Cosmos_Key: C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw== \ No newline at end of file From 1718e2701887b2ff113268daeb46fe0978341ba9 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 30 Jul 2025 03:26:48 +0000 Subject: [PATCH 4/4] Add vnext emulator testing with failure tolerance Co-authored-by: philnach <19275540+philnach@users.noreply.github.com> --- .../workflows/linux-cosmos-emulator-test.yml | 24 +++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/.github/workflows/linux-cosmos-emulator-test.yml b/.github/workflows/linux-cosmos-emulator-test.yml index f20bcac..415db2c 100644 --- a/.github/workflows/linux-cosmos-emulator-test.yml +++ b/.github/workflows/linux-cosmos-emulator-test.yml @@ -9,11 +9,27 @@ on: jobs: cosmos_tests_linux: - name: Run Cosmos .NET unit tests on Linux + name: Run Cosmos .NET unit tests on Linux (${{ matrix.emulator_version.name }}) runs-on: ubuntu-latest + strategy: + matrix: + emulator_version: [ + { + name: "current", + image: "mcr.microsoft.com/cosmosdb/linux/azure-cosmos-emulator:latest", + allow_failure: false + }, + { + name: "vnext", + image: "mcr.microsoft.com/cosmosdb/linux/azure-cosmos-emulator:vnext-preview", + allow_failure: true + } + ] + fail-fast: false + continue-on-error: ${{ matrix.emulator_version.allow_failure }} services: cosmos-emulator: - image: mcr.microsoft.com/cosmosdb/linux/azure-cosmos-emulator:latest + image: ${{ matrix.emulator_version.image }} ports: - 8081:8081 - 10251:10251 @@ -46,7 +62,7 @@ jobs: - name: Wait for Cosmos Emulator run: | - echo "Waiting for Cosmos DB Emulator to be ready..." + echo "Waiting for Cosmos DB Emulator (${{ matrix.emulator_version.name }}) to be ready..." timeout 300 bash -c 'until curl -f -k https://127.0.0.1:8081/_explorer/emulator.pem; do sleep 5; done' echo "Cosmos DB Emulator is ready!" @@ -58,7 +74,7 @@ jobs: - name: Run Cosmos Extension Tests run: | - echo "Running Cosmos extension unit tests with emulator connection..." + echo "Running Cosmos extension unit tests with emulator connection (${{ matrix.emulator_version.name }})..." echo "Cosmos_Endpoint: $Cosmos_Endpoint" echo "Testing connectivity to emulator..." curl -k -s https://127.0.0.1:8081/_explorer/index.html > /dev/null && echo "Emulator is responding" || echo "Warning: Emulator may not be fully ready"