Skip to content
Merged
Show file tree
Hide file tree
Changes from 16 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 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 explicit Cosmos selection' {
$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: ubuntu-latest\r?$' 'The Cosmos partition must use the native Linux backend.'
Assert-Matches `
$cosmosJob `
'coverage: \$\{\{ matrix\.framework == ''net10\.0'' \}\}' `
'The Cosmos job must select 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
36 changes: 18 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ 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
COSMOSDB_EMULATOR_IMAGE: mcr.microsoft.com/cosmosdb/linux/azure-cosmos-emulator:vnext-EN20260907@sha256:2db1f9e74c506bcf6fc347aa937aea1c00fa756061296a5a9efba530ce86ec02
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 @@ -432,43 +432,35 @@ jobs:
steps:
- uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
- name: Start Azure Cosmos DB emulator
id: cosmos-emulator
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 \
-p 8081:8081 -p 8080:8080 \
-e PROTOCOL=https \
-e ENABLE_EXPLORER=false \
-e ENABLE_TELEMETRY=false \
-e LOG_LEVEL=warn \
"$COSMOSDB_EMULATOR_IMAGE"
- name: Wait for Azure Cosmos DB emulator
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"
for attempt in {1..60}; do
if curl --fail --silent --show-error http://localhost:8080/ready; then
echo "ORLEANSCOSMOSDBACCOUNTENDPOINT=https://localhost:8081/" >> "$GITHUB_ENV"
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
echo "::error::Azure Cosmos DB emulator did not become ready."
exit 1
- 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")]
Expand All @@ -477,7 +469,15 @@ jobs:
ORLEANSCOSMOSDBACCOUNTKEY: "C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw=="
- name: Clean up Azure Cosmos DB emulator
if: always()
run: docker rm -f cosmosdb-emulator || true
run: |
container_id=$(docker ps --all --quiet --filter 'name=^/cosmosdb-emulator$')
if [ -n "$container_id" ]; then
docker inspect --format '{{json .State}}' "$container_id"
docker logs --tail 200 "$container_id"
docker rm -f "$container_id"
else
echo "Cosmos DB emulator container was not created."
fi
test-consul:
name: Consul provider tests
runs-on: ubuntu-latest
Expand Down
Loading
Loading