-
Notifications
You must be signed in to change notification settings - Fork 775
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add concurrency tests with Coyote to CI (#4879)
- Loading branch information
Showing
11 changed files
with
298 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Syntax: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions | ||
# See also: https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/troubleshooting-required-status-checks#handling-skipped-but-required-checks | ||
|
||
# Description: This workflow exists to unblock documentation-only PRs. | ||
|
||
# IMPORTANT: This workflow MUST use the same 'name' and 'matrix' as the non -md workflow. | ||
|
||
|
||
name: Coyote Concurrency Tests | ||
|
||
on: | ||
push: | ||
branches: [ 'main*' ] | ||
paths-ignore: | ||
- '**.md' | ||
pull_request: | ||
branches: [ 'main*' ] | ||
paths: | ||
- '**.md' | ||
|
||
jobs: | ||
coyote-concurrency-tests: | ||
|
||
strategy: | ||
fail-fast: false # ensures the entire test matrix is run, even if one permutation fails | ||
matrix: | ||
os: [ windows-latest, ubuntu-latest ] | ||
version: [ net8.0 ] | ||
project: [ OpenTelemetry.Tests, OpenTelemetry.Api.Tests ] | ||
|
||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- run: 'echo "No build required"' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: Coyote Concurrency Tests | ||
|
||
on: | ||
push: | ||
branches: [ 'main*' ] | ||
paths-ignore: | ||
- '**.md' | ||
pull_request: | ||
branches: [ 'main*' ] | ||
paths-ignore: | ||
- '**.md' | ||
|
||
jobs: | ||
coyote-concurrency-tests: | ||
|
||
strategy: | ||
fail-fast: false # ensures the entire test matrix is run, even if one permutation fails | ||
matrix: | ||
os: [ windows-latest, ubuntu-latest ] | ||
version: [ net8.0 ] | ||
project: [ OpenTelemetry.Tests, OpenTelemetry.Api.Tests ] | ||
|
||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 # fetching all | ||
|
||
- name: Setup dotnet | ||
uses: actions/setup-dotnet@v3 | ||
|
||
- name: Run Coyote Tests | ||
shell: pwsh | ||
run: .\build\test-threadSafety.ps1 -testProjectName ${{ matrix.project }} -targetFramework ${{ matrix.version }} | ||
|
||
- name: Publish Artifacts | ||
if: always() && !cancelled() | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ matrix.os }}-${{ matrix.project }}-${{ matrix.version }}-coyoteoutput | ||
path: '**/*_CoyoteOutput.*' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -348,3 +348,6 @@ ASALocalRun/ | |
|
||
# Tempo files | ||
tempo-data/ | ||
|
||
# Coyote Rewrite Files | ||
rewrite.coyote.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
param( | ||
[Parameter()][string]$coyoteVersion="1.7.10", | ||
[Parameter(Mandatory=$true)][string]$testProjectName, | ||
[Parameter(Mandatory=$true)][string]$targetFramework, | ||
[Parameter()][string]$categoryName="CoyoteConcurrencyTests", | ||
[Parameter()][string]$configuration="Release" | ||
) | ||
|
||
$env:OTEL_RUN_COYOTE_TESTS = 'true' | ||
|
||
$rootDirectory = Split-Path $PSScriptRoot -Parent | ||
|
||
Write-Host "Install Coyote CLI." | ||
dotnet tool install --global Microsoft.Coyote.CLI | ||
|
||
Write-Host "Build $testProjectName project." | ||
dotnet build "$rootDirectory/test/$testProjectName/$testProjectName.csproj" --configuration $configuration | ||
|
||
$artifactsPath = Join-Path $rootDirectory "test/$testProjectName/bin/$configuration/$targetFramework" | ||
|
||
Write-Host "Generate Coyote rewriting options JSON file." | ||
$assemblies = Get-ChildItem $artifactsPath -Filter OpenTelemetry*.dll | ForEach-Object {$_.Name} | ||
|
||
$RewriteOptionsJson = @{} | ||
[void]$RewriteOptionsJson.Add("AssembliesPath", $artifactsPath) | ||
[void]$RewriteOptionsJson.Add("Assemblies", $assemblies) | ||
$RewriteOptionsJson | ConvertTo-Json -Compress | Set-Content -Path "$rootDirectory/test/$testProjectName/rewrite.coyote.json" | ||
|
||
Write-Host "Run Coyote rewrite." | ||
coyote rewrite "$rootDirectory/test/$testProjectName/rewrite.coyote.json" | ||
|
||
Write-Host "Execute re-written binary." | ||
dotnet test "$artifactsPath/$testProjectName.dll" --framework $targetFramework --filter CategoryName=$categoryName | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
<Project> | ||
<Import Project="$([MSBuild]::GetPathOfFileAbove(Directory.Packages.props, $(MSBuildThisFileDirectory)..))" /> | ||
<ItemGroup> | ||
<PackageVersion Update="System.Text.Json" Version="6.0.5" /> | ||
<PackageVersion Update="System.Text.Json" Version="7.0.1" /> | ||
<PackageVersion Include="System.Runtime.InteropServices.RuntimeInformation" Version="4.3.0" /> | ||
<PackageVersion Include="Microsoft.Coyote" Version="1.7.10" /> | ||
</ItemGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.