Skip to content

Commit

Permalink
Test (#579)
Browse files Browse the repository at this point in the history
  • Loading branch information
dszmigielski authored Dec 6, 2022
1 parent 8b7cd26 commit 0d8f546
Showing 1 changed file with 29 additions and 20 deletions.
49 changes: 29 additions & 20 deletions .github/workflows/script-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ jobs:
- name: Test the PowerShell module instructions from README.md
shell: powershell
run: |
dotnet build -c Release ./test/test-applications/integrations/TestApplication.Smoke/TestApplication.Smoke.csproj
mkdir testapp
cd testapp
dotnet new console
dotnet publish -f net7.0 -c Release
$module_url = "https://raw.githubusercontent.com/${{ github.repository }}/${{ github.sha }}/OpenTelemetry.DotNet.Auto.psm1"
$dl_path = Join-Path $env:temp "OpenTelemetry.DotNet.Auto.psm1"
$log_path = "C:\ProgramData\OpenTelemetry .NET AutoInstrumentation\logs\*"
Expand All @@ -26,12 +29,12 @@ jobs:
Install-OpenTelemetryCore
$install_dir = Get-OpenTelemetryInstallDirectory
Register-OpenTelemetryForCurrentSession -OTelServiceName "MyServiceDisplayName"
./test/test-applications/integrations/TestApplication.Smoke/bin/Release/net7.0/TestApplication.Smoke.exe
./bin/Release/net7.0/publish/testapp
if (-not $?) { throw "dotnet help returned exit code: $LASTEXITCODE" }
if (-not (Test-Path $log_path)) { throw "Log file does not exist. Instrumentation test failed." }
Remove-Item $log_path
Unregister-OpenTelemetryForCurrentSession
./test/test-applications/integrations/TestApplication.Smoke/bin/Release/net7.0/TestApplication.Smoke.exe
./bin/Release/net7.0/publish/testapp
if (-not $?) { throw "dotnet help returned exit code: $LASTEXITCODE" }
if (Test-Path $log_path) { throw "Log file exists. Instrumentation unregister failed." }
Uninstall-OpenTelemetryCore
Expand Down Expand Up @@ -64,13 +67,16 @@ jobs:
shell: bash
run: |
set -e
dotnet publish -f net7.0 -c Release ./test/test-applications/integrations/TestApplication.Smoke
mkdir testapp
cd testapp
dotnet new console
dotnet publish -f net7.0 -c Release
curl -sSfL https://raw.githubusercontent.com/${{ github.repository }}/${{ github.sha }}/otel-dotnet-auto-install.sh -O
sh ./otel-dotnet-auto-install.sh
test "$(ls -A "$HOME/.otel-dotnet-auto")"
curl -sSfL https://raw.githubusercontent.com/${{ github.repository }}/${{ github.sha }}/instrument.sh -O
. ./instrument.sh
./test/test-applications/integrations/TestApplication.Smoke/bin/Release/net7.0/publish/TestApplication.Smoke
./bin/Release/net7.0/publish/testapp
test "$(ls -A '${{ matrix.log-dir }}' )"
shell-scripts-container:
Expand All @@ -80,19 +86,22 @@ jobs:
base-image: [ alpine ]
runs-on: ubuntu-20.04
steps:
- uses: actions/[email protected]
- name: Test the Shell scripts from README.md in Docker container
run: |
set -e
docker build -t mybuildimage -f "./docker/${{ matrix.base-image }}.dockerfile" .
docker run --mount type=bind,source="${GITHUB_WORKSPACE}",target=/project --rm mybuildimage /bin/sh -c '
- uses: actions/[email protected]
- name: Test the Shell scripts from README.md in Docker container
run: |
set -e
dotnet publish -f net7.0 -c Release ./test/test-applications/integrations/TestApplication.Smoke
curl -sSfL https://raw.githubusercontent.com/${{ github.repository }}/${{ github.sha }}/otel-dotnet-auto-install.sh -O
sh ./otel-dotnet-auto-install.sh
test "$(ls -A "$HOME/.otel-dotnet-auto")"
curl -sSfL https://raw.githubusercontent.com/${{ github.repository }}/${{ github.sha }}/instrument.sh -O
. ./instrument.sh
./test/test-applications/integrations/TestApplication.Smoke/bin/Release/net7.0/publish/TestApplication.Smoke
test "$(ls -A /var/log/opentelemetry/dotnet )"
'
docker build -t mybuildimage -f "./docker/${{ matrix.base-image }}.dockerfile" .
docker run --mount type=bind,source="${GITHUB_WORKSPACE}",target=/project --rm mybuildimage /bin/sh -c '
set -e
mkdir testapp
cd testapp
dotnet new console
dotnet publish -f net7.0 -c Release
curl -sSfL https://raw.githubusercontent.com/${{ github.repository }}/${{ github.sha }}/otel-dotnet-auto-install.sh -O
sh ./otel-dotnet-auto-install.sh
test "$(ls -A "$HOME/.otel-dotnet-auto")"
curl -sSfL https://raw.githubusercontent.com/${{ github.repository }}/${{ github.sha }}/instrument.sh -O
. ./instrument.sh
./bin/Release/net7.0/publish/testapp
test "$(ls -A /var/log/opentelemetry/dotnet )"
'

0 comments on commit 0d8f546

Please sign in to comment.