-
Notifications
You must be signed in to change notification settings - Fork 72
68 lines (61 loc) · 2.5 KB
/
linux-cosmos-emulator-test.yml
File metadata and controls
68 lines (61 loc) · 2.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
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==