Skip to content
Open
Changes from 4 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
68 changes: 68 additions & 0 deletions .github/workflows/linux-cosmos-emulator-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
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: |
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==
Loading