From 0d8f546e789b6c6fdadd4ff96b987bcb8b7b9736 Mon Sep 17 00:00:00 2001 From: Dawid Szmigielski Date: Tue, 6 Dec 2022 10:12:46 +0100 Subject: [PATCH] Test (#579) --- .github/workflows/script-tests.yml | 49 ++++++++++++++++++------------ 1 file changed, 29 insertions(+), 20 deletions(-) diff --git a/.github/workflows/script-tests.yml b/.github/workflows/script-tests.yml index 62b2568d64..abdc451860 100644 --- a/.github/workflows/script-tests.yml +++ b/.github/workflows/script-tests.yml @@ -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\*" @@ -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 @@ -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: @@ -80,19 +86,22 @@ jobs: base-image: [ alpine ] runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v3.1.0 - - 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/checkout@v3.1.0 + - 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 )" + '