Skip to content
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
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
12 changes: 8 additions & 4 deletions .github/actions/run-tests/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ inputs:
description: Build external assets required by the selected tests.
required: false
default: 'false'
coverage:
description: Collect coverage ('true' or 'false'); 'auto' selects Linux .NET 10 jobs.
required: false
default: 'auto'
filter-query:
description: Optional Microsoft Testing Platform query filter.
required: false
Expand All @@ -30,7 +34,7 @@ runs:
steps:
- uses: ./.github/actions/setup-test-environment
with:
coverage: ${{ runner.os == 'Linux' && inputs.framework == 'net10.0' }}
coverage: ${{ inputs.coverage == 'true' || (inputs.coverage == 'auto' && runner.os == 'Linux' && inputs.framework == 'net10.0') }}
- name: Test
id: test
continue-on-error: ${{ env.ORLEANS_TEST_RETRY == 'true' }}
Expand All @@ -40,7 +44,7 @@ runs:
filter-query: ${{ inputs.filter-query || format('/[(Provider={0})&((Suite=BVT)|(Suite=SlowBVT)|(Suite=Functional))&(Category!=Performance)&(Category!=Stress)]', inputs.provider) }}
framework: ${{ inputs.framework }}
result-id: ${{ inputs.retry == 'true' && format('{0}-attempt1', inputs.artifact-name) || inputs.artifact-name }}
coverage: ${{ runner.os == 'Linux' && inputs.framework == 'net10.0' }}
coverage: ${{ inputs.coverage == 'true' || (inputs.coverage == 'auto' && runner.os == 'Linux' && inputs.framework == 'net10.0') }}
env:
# The nested composite action supplies its own inputs context when continue-on-error is evaluated.
ORLEANS_TEST_RETRY: ${{ inputs.retry }}
Expand All @@ -54,13 +58,13 @@ runs:
filter-query: ${{ inputs.filter-query || format('/[(Provider={0})&((Suite=BVT)|(Suite=SlowBVT)|(Suite=Functional))&(Category!=Performance)&(Category!=Stress)]', inputs.provider) }}
framework: ${{ inputs.framework }}
result-id: ${{ format('{0}-attempt2', inputs.artifact-name) }}
coverage: ${{ runner.os == 'Linux' && inputs.framework == 'net10.0' }}
coverage: ${{ inputs.coverage == 'true' || (inputs.coverage == 'auto' && runner.os == 'Linux' && inputs.framework == 'net10.0') }}
env:
BuildExternalAssets: ${{ inputs['build-external-assets'] }}
- name: Archive test results
if: always()
uses: ./.github/actions/archive-test-results
with:
coverage: ${{ runner.os == 'Linux' && inputs.framework == 'net10.0' }}
coverage: ${{ inputs.coverage == 'true' || (inputs.coverage == 'auto' && runner.os == 'Linux' && inputs.framework == 'net10.0') }}
name: ${{ inputs.artifact-name }}
retention-days: ${{ steps.test.outcome == 'failure' && steps.retry.outcome != 'success' && 14 || 1 }}
18 changes: 15 additions & 3 deletions .github/scripts/test-summarize-coverage.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -1099,7 +1099,7 @@ exit 0
Assert-Equal 23 $expectedArtifacts.Count 'Expected coverage artifact count differs.'
Assert-Equal 23 (@($expectedArtifacts | Sort-Object -Unique)).Count 'Expected coverage artifact identities must be unique.'
Assert-Equal 0 (@($expectedArtifacts | Where-Object { $_ -notmatch 'net10\.0$' })).Count 'Coverage artifacts must target .NET 10.'
Assert-Equal 0 (@($expectedArtifacts | Where-Object { $_ -match 'macos|windows' })).Count 'Coverage artifacts must target Linux.'
Assert-Equal $true ($expectedArtifacts -contains 'test_output_test-azure-cosmosdb_net10.0') 'The Windows Cosmos partition must retain its expected coverage artifact.'
}

Invoke-Test 'rejects missing and unexpected coverage artifacts' {
Expand Down Expand Up @@ -1515,7 +1515,7 @@ exit 0
'Coverage upload must retry under a distinct immutable name and keep the retry gating.'
}

Invoke-Test 'collects GitHub coverage only on Linux .NET 10' {
Invoke-Test 'defaults GitHub coverage to Linux .NET 10 with a Windows Cosmos override' {
$workflow = Get-Content -Raw -LiteralPath $workflowPath
$runTestsAction = Get-Content -Raw -LiteralPath $runTestsActionPath
$dotnetTestAction = Get-Content -Raw -LiteralPath $dotnetTestActionPath
Expand All @@ -1526,7 +1526,19 @@ exit 0
$wrappedTestCommands = ([regex]::Matches($dotnetTestAction, 'invoke-test\.ps1')).Count
$coveredTestCommands = ([regex]::Matches($dotnetTestAction, "(?s)'dotnet'\s*'test'\s*'--solution'\s*'Orleans\.slnx'")).Count
Assert-Equal 2 ($wrappedTestCommands + $coveredTestCommands) 'Native test command count differs.'
Assert-Equal 4 ([regex]::Matches($runTestsAction, "runner\.os == 'Linux' && inputs\.framework == 'net10\.0'")).Count 'Coverage selection boundary count differs.'
Assert-Matches `
$runTestsAction `
"(?ms)^ coverage:\r?\n description: [^\r\n]+\r?\n required: false\r?\n default: 'auto'" `
'Coverage selection must preserve the default Linux .NET 10 policy when no override is supplied.'
$coverageSelection = '${{ inputs.coverage == ''true'' || (inputs.coverage == ''auto'' && runner.os == ''Linux'' && inputs.framework == ''net10.0'') }}'
Assert-Equal 4 ([regex]::Matches($runTestsAction, [regex]::Escape("coverage: $coverageSelection"))).Count 'Setup, test, retry, and archive must all honor the same coverage override.'
$cosmosJob = [regex]::Match($workflow, '(?ms)^ test-azure-cosmosdb:\r?\n.*?(?=^ [A-Za-z0-9_-]+:|\z)').Value
Assert-Matches $cosmosJob '(?m)^ runs-on: windows-2025\r?$' 'The Cosmos partition must retain the native Windows backend.'
Assert-Matches `
$cosmosJob `
'coverage: \$\{\{ matrix\.framework == ''net10\.0'' \}\}' `
'The Windows Cosmos job must opt into coverage only for .NET 10.'
Assert-Equal 1 ([regex]::Matches($workflow, '(?m)^ coverage:')).Count 'Only the Cosmos partition should override the default collection policy.'
Assert-Equal 0 ([regex]::Matches($workflow + $runTestsAction + $dotnetTestAction, 'static-instrumentation|coverage\.static\.config\.xml|IncludeFiles')).Count 'GitHub coverage must not use static instrumentation.'
Assert-Equal 1 ([regex]::Matches($workflow, "retry: 'true'")).Count 'Cosmos retry configuration count differs.'
Assert-Matches $runTestsAction 'attempt1' 'The first retryable attempt must retain distinct test results.'
Expand Down
63 changes: 32 additions & 31 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ env:
# Docker images started by workflow steps are centralized so pulls can be retried and mirrors can be swapped in one place.
AZURITE_IMAGE: mcr.microsoft.com/azure-storage/azurite:3.35.0@sha256:647c63a91102a9d8e8000aab803436e1fc85fbb285e7ce830a82ee5d6661cf37
EVENTHUBS_EMULATOR_IMAGE: mcr.microsoft.com/azure-messaging/eventhubs-emulator:2.2.0@sha256:2c8e0d4dd93a5fc078df2721eeb3e211442d555d61293ac3972df931c6d9333a
COSMOSDB_EMULATOR_IMAGE: mcr.microsoft.com/cosmosdb/linux/azure-cosmos-emulator:vnext-preview@sha256:bf3bd3cbe3fae2005a0745f77b01d1fc8cd04112193f3ee32289ee15ee9ae5fa
CONSUL_IMAGE: public.ecr.aws/hashicorp/consul:1.19
DYNAMODB_IMAGE: amazon/dynamodb-local:latest
ELASTICMQ_IMAGE: softwaremill/elasticmq-native:latest
Expand Down Expand Up @@ -424,60 +423,62 @@ jobs:
run: docker rm -f azurite || true
test-azure-cosmosdb:
name: Azure Cosmos DB provider tests
runs-on: ubuntu-latest
runs-on: windows-2025
env:
COSMOSDB_EMULATOR_VERSION: 2.14.28.0
strategy:
fail-fast: false
matrix:
framework: ["net8.0", "net10.0"]
steps:
- uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
- name: Start Azure Cosmos DB emulator
id: cosmos-emulator
shell: powershell
run: |
set -euo pipefail

bash .github/scripts/docker-pull-with-retry.sh "$COSMOSDB_EMULATOR_IMAGE"

docker run -d --pull=never --name cosmosdb-emulator \
-p 8081:8081 \
-e PROTOCOL=https \
-e ENABLE_EXPLORER=false \
-e ENABLE_TELEMETRY=false \
-e LOG_LEVEL=warn \
"$COSMOSDB_EMULATOR_IMAGE"
$emulator = Get-Item "$env:ProgramFiles\Azure Cosmos DB Emulator\Microsoft.Azure.Cosmos.Emulator.exe"
$version = $emulator.VersionInfo.FileVersion
Write-Host "Runner image: $env:ImageOS $env:ImageVersion; Cosmos emulator: $version"
if ($version -ne $env:COSMOSDB_EMULATOR_VERSION) {
throw "Expected Cosmos emulator $env:COSMOSDB_EMULATOR_VERSION, found $version."
}
Import-Module "$env:ProgramFiles\Azure Cosmos DB Emulator\PSModules\Microsoft.Azure.CosmosDB.Emulator"
Start-CosmosDbEmulator -Consistency Strong -NoUI -NoTelemetry -NoWait
- name: Wait for Azure Cosmos DB emulator
shell: powershell
run: |
endpoint="https://localhost:8081/"
echo "Waiting for Azure Cosmos DB emulator to be ready..."
for i in {1..60}; do
if curl --silent --show-error --insecure "${endpoint}" > /dev/null; then
echo "Azure Cosmos DB emulator is ready"
echo "ORLEANSCOSMOSDBACCOUNTENDPOINT=${endpoint}" >> "$GITHUB_ENV"
Import-Module "$env:ProgramFiles\Azure Cosmos DB Emulator\PSModules\Microsoft.Azure.CosmosDB.Emulator"
$endpoint = "https://localhost:8081/"
foreach ($attempt in 1..60) {
$status = Get-CosmosDbEmulatorStatus
Write-Host "Cosmos emulator status: $status"
if ($status -eq "Running") {
"ORLEANSCOSMOSDBACCOUNTENDPOINT=$endpoint" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
exit 0
fi

if [ "$i" -eq 60 ]; then
docker logs --tail 200 cosmosdb-emulator
echo "Azure Cosmos DB emulator did not become ready in time."
exit 1
fi

sleep 2
done
}
Start-Sleep -Seconds 2
}
throw "Azure Cosmos DB emulator did not become ready."
- name: Test
uses: ./.github/actions/run-tests
with:
artifact-name: test_output_${{ github.job }}_${{ matrix.framework }}
framework: ${{ matrix.framework }}
provider: Cosmos
coverage: ${{ matrix.framework == 'net10.0' }}
retry: 'true'
env:
# [SuppressMessage("Microsoft.Security", "CS002:SecretInNextLine", Justification="Not a secret")]
#ORLEANSCOSMOSDBACCOUNTENDPOINT: "https://localhost:8081/"
# [SuppressMessage("Microsoft.Security", "CS002:SecretInNextLine", Justification="Not a secret")]
ORLEANSCOSMOSDBACCOUNTKEY: "C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw=="
- name: Clean up Azure Cosmos DB emulator
if: always()
run: docker rm -f cosmosdb-emulator || true
if: always() && steps.cosmos-emulator.outcome == 'success'
shell: powershell
run: |
Import-Module "$env:ProgramFiles\Azure Cosmos DB Emulator\PSModules\Microsoft.Azure.CosmosDB.Emulator"
Get-CosmosDbEmulatorStatus | Write-Host
Stop-CosmosDbEmulator
test-consul:
name: Consul provider tests
runs-on: ubuntu-latest
Expand Down
Loading
Loading