Skip to content

Commit cecdaa5

Browse files
committed
Split out oss versions
1 parent 2e0fa7c commit cecdaa5

File tree

7 files changed

+731
-114
lines changed

7 files changed

+731
-114
lines changed

build/docker-compose.test.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
version: '3.8'
2+
3+
services:
4+
sql:
5+
container_name: fhir-test-sql
6+
image: mcr.microsoft.com/mssql/server:2022-latest
7+
environment:
8+
ACCEPT_EULA: Y
9+
SA_PASSWORD: ${SQL_SA_PASSWORD:-YourStrong!Passw0rd}
10+
MSSQL_PID: Developer
11+
ports:
12+
- "1433:1433"
13+
healthcheck:
14+
test: /opt/mssql-tools18/bin/sqlcmd -S localhost -U sa -P "$${SA_PASSWORD}" -C -Q "SELECT 1" || exit 1
15+
interval: 10s
16+
timeout: 3s
17+
retries: 10
18+
start_period: 10s
19+
volumes:
20+
- sql-data:/var/opt/mssql
21+
22+
cosmos:
23+
container_name: fhir-test-cosmos
24+
image: mcr.microsoft.com/cosmosdb/linux/azure-cosmos-emulator:latest
25+
mem_limit: 3g
26+
cpu_count: 2
27+
environment:
28+
AZURE_COSMOS_EMULATOR_PARTITION_COUNT: 2
29+
AZURE_COSMOS_EMULATOR_ENABLE_DATA_PERSISTENCE: "false"
30+
AZURE_COSMOS_EMULATOR_IP_ADDRESS_OVERRIDE: "127.0.0.1"
31+
ports:
32+
- "8081:8081"
33+
- "10250-10255:10250-10255"
34+
healthcheck:
35+
test: curl -k https://localhost:8081/_explorer/emulator.pem || exit 1
36+
interval: 30s
37+
timeout: 10s
38+
retries: 10
39+
start_period: 120s
40+
41+
azurite:
42+
container_name: fhir-test-azurite
43+
image: mcr.microsoft.com/azure-storage/azurite:latest
44+
ports:
45+
- "10000:10000"
46+
- "10001:10001"
47+
- "10002:10002"
48+
command: azurite --blobHost 0.0.0.0 --queueHost 0.0.0.0 --tableHost 0.0.0.0 --loose
49+
healthcheck:
50+
test: nc -z localhost 10000 || exit 1
51+
interval: 10s
52+
timeout: 3s
53+
retries: 10
54+
start_period: 10s
55+
56+
volumes:
57+
sql-data:
Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
parameters:
2+
- name: version
3+
type: string
4+
5+
steps:
6+
- checkout: self
7+
fetchDepth: 1
8+
fetchTags: false
9+
10+
- task: UseDotNet@2
11+
inputs:
12+
useGlobalJson: true
13+
14+
- task: DockerCompose@0
15+
displayName: 'Start CosmosDB Emulator and Azurite containers'
16+
inputs:
17+
action: 'Run services'
18+
dockerComposeFile: '$(Build.SourcesDirectory)/build/docker-compose.test.yml'
19+
projectName: 'fhir-server-test-${{ lower(parameters.version) }}-cosmos'
20+
dockerComposeCommand: 'up -d cosmos azurite'
21+
detached: true
22+
23+
- script: |
24+
echo "Waiting for Cosmos DB Emulator to be ready..."
25+
timeout=240
26+
elapsed=0
27+
until docker exec fhir-test-cosmos curl -k https://localhost:8081/_explorer/emulator.pem > /dev/null 2>&1 || [ $elapsed -ge $timeout ]; do
28+
echo "Waiting for Cosmos DB Emulator... ($elapsed seconds)"
29+
sleep 10
30+
elapsed=$((elapsed + 10))
31+
done
32+
echo "Cosmos DB Emulator is ready"
33+
displayName: 'Verify Cosmos DB Emulator connectivity'
34+
35+
- script: |
36+
echo "Exporting and trusting CosmosDB Emulator SSL certificate..."
37+
# Extract certificate from the emulator
38+
curl -k https://localhost:8081/_explorer/emulator.pem > ~/emulatorcert.crt
39+
40+
# Install to system certificate store
41+
sudo cp ~/emulatorcert.crt /usr/local/share/ca-certificates/
42+
sudo update-ca-certificates
43+
44+
echo "CosmosDB Emulator certificate trusted"
45+
displayName: 'Trust CosmosDB Emulator SSL certificate'
46+
47+
- script: |
48+
echo "Waiting for Azurite to be ready..."
49+
timeout=60
50+
elapsed=0
51+
until curl -f http://localhost:10000/devstoreaccount1?restype=account > /dev/null 2>&1 || [ $elapsed -ge $timeout ]; do
52+
echo "Waiting for Azurite... ($elapsed seconds)"
53+
sleep 5
54+
elapsed=$((elapsed + 5))
55+
done
56+
echo "Azurite is ready"
57+
displayName: 'Verify Azurite connectivity'
58+
59+
- task: DotNetCoreCLI@2
60+
displayName: 'Build ${{ parameters.version }} integration test project'
61+
inputs:
62+
command: build
63+
projects: 'test/**/*${{ parameters.version }}.Tests.Integration.csproj'
64+
arguments: '--configuration $(buildConfiguration) -f $(defaultBuildFramework)'
65+
66+
- task: DotNetCoreCLI@2
67+
displayName: 'Run ${{ parameters.version }} CosmosDB Integration Tests'
68+
inputs:
69+
command: test
70+
projects: 'test/**/*${{ parameters.version }}.Tests.Integration.csproj'
71+
arguments: '--filter DisplayName!~SqlServer --configuration $(buildConfiguration) --collect "XPlat Code Coverage" -s "$(build.sourcesDirectory)/CodeCoverage.runsettings" -v normal --no-build -f $(defaultBuildFramework)'
72+
testRunTitle: '${{ parameters.version }} Docker CosmosDB Integration Tests'
73+
publishTestResults: true
74+
env:
75+
'CosmosDb__Host': 'https://localhost:8081'
76+
'CosmosDb__Key': 'C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw=='
77+
'CosmosDb__DatabaseId': 'FhirTests'
78+
'TestExportStoreUri': 'http://127.0.0.1:10000/devstoreaccount1'
79+
'TestIntegrationStoreUri': 'http://127.0.0.1:10000/devstoreaccount1'
80+
81+
- task: DotNetCoreCLI@2
82+
displayName: 'Build ${{ parameters.version }} E2E test project'
83+
inputs:
84+
command: build
85+
projects: 'test/**/*${{ parameters.version }}.Tests.E2E.csproj'
86+
arguments: '--configuration $(buildConfiguration) -f $(defaultBuildFramework)'
87+
88+
- task: DotNetCoreCLI@2
89+
displayName: 'Run ${{ parameters.version }} CosmosDB E2E Tests (In-Proc)'
90+
inputs:
91+
command: test
92+
projects: 'test/**/*${{ parameters.version }}.Tests.E2E.csproj'
93+
arguments: '--filter FullyQualifiedName~CosmosDb --configuration $(buildConfiguration) --collect "XPlat Code Coverage" -s "$(build.sourcesDirectory)/CodeCoverage.runsettings" -v normal --no-build -f $(defaultBuildFramework)'
94+
testRunTitle: '${{ parameters.version }} Docker CosmosDB E2E Tests'
95+
publishTestResults: true
96+
env:
97+
'CosmosDb__Host': 'https://localhost:8081'
98+
'CosmosDb__Key': 'C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw=='
99+
'CosmosDb__DatabaseId': 'FhirTests'
100+
'TestExportStoreUri': 'http://127.0.0.1:10000/devstoreaccount1'
101+
'TestIntegrationStoreUri': 'http://127.0.0.1:10000/devstoreaccount1'
102+
103+
- task: reportgenerator@5
104+
displayName: 'Aggregate ${{ parameters.version }} CosmosDB test coverage'
105+
condition: succeededOrFailed()
106+
inputs:
107+
reports: '$(Agent.TempDirectory)/*/coverage.cobertura.xml'
108+
reporttypes: 'Cobertura'
109+
targetdir: '$(Agent.TempDirectory)/coverage'
110+
111+
- task: PublishBuildArtifacts@1
112+
displayName: 'Publish ${{ parameters.version }} CosmosDB test coverage'
113+
condition: succeededOrFailed()
114+
inputs:
115+
pathToPublish: '$(Agent.TempDirectory)/coverage'
116+
artifactName: 'Coverage_Docker_CosmosDB_${{ parameters.version }}'
117+
artifactType: 'container'
118+
119+
- task: PublishCodeCoverageResults@1
120+
displayName: 'Publish ${{ parameters.version }} CosmosDB code coverage results'
121+
condition: always()
122+
inputs:
123+
codeCoverageTool: 'Cobertura'
124+
summaryFileLocation: '$(Agent.TempDirectory)/coverage/Cobertura.xml'
125+
reportDirectory: '$(Agent.TempDirectory)/coverage'
126+
127+
- task: DockerCompose@0
128+
displayName: 'Stop and remove containers'
129+
condition: always()
130+
inputs:
131+
action: 'Run a Docker Compose command'
132+
dockerComposeFile: '$(Build.SourcesDirectory)/build/docker-compose.test.yml'
133+
projectName: 'fhir-server-test-${{ lower(parameters.version) }}-cosmos'
134+
dockerComposeCommand: 'down -v'

0 commit comments

Comments
 (0)