Skip to content

Commit 4e52848

Browse files
authored
[Profiler] Run profiler integration tests in AzDo (DataDog#2830)
1 parent f4fb779 commit 4e52848

35 files changed

+983
-303
lines changed

.azure-pipelines/ultimate-pipeline.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1122,6 +1122,75 @@ stages:
11221122
baseImage: $(baseImage)
11231123
command: "CheckBuildLogsForErrors"
11241124

1125+
- stage: profiler_integration_tests_linux
1126+
condition: and(succeeded(), eq(variables['isScheduledBuild'], 'False'))
1127+
dependsOn: [package_linux, generate_variables, master_commit_id]
1128+
variables:
1129+
masterCommitId: $[ stageDependencies.master_commit_id.fetch.outputs['set_sha.master']]
1130+
jobs:
1131+
- template: steps/update-github-status-jobs.yml
1132+
parameters:
1133+
jobs: [Test]
1134+
1135+
- job: Test
1136+
timeoutInMinutes: 60 #default value
1137+
strategy:
1138+
matrix:
1139+
debian:
1140+
baseImage: debian
1141+
alpine:
1142+
baseImage: alpine
1143+
1144+
variables:
1145+
IncludeMinorPackageVersions: $[eq(variables.perform_comprehensive_testing, 'true')]
1146+
1147+
pool:
1148+
name: azure-linux-scale-set
1149+
1150+
steps:
1151+
- template: steps/clone-repo.yml
1152+
parameters:
1153+
masterCommitId: $(masterCommitId)
1154+
1155+
- template: steps/restore-working-directory.yml
1156+
parameters:
1157+
artifact: build-linux-$(baseImage)-working-directory
1158+
1159+
- task: DownloadPipelineArtifact@2
1160+
displayName: Download linux monitoring home
1161+
inputs:
1162+
artifact: linux-monitoring-home-$(baseImage)
1163+
path: $(System.DefaultWorkingDirectory)/shared/bin/monitoring-home
1164+
1165+
# when we build samples separately, we could run this step and the docker-compose one below in //
1166+
# (currently the docker-compose step relies on serverless samples)
1167+
- template: steps/run-in-docker.yml
1168+
parameters:
1169+
build: true
1170+
baseImage: $(baseImage)
1171+
command: "BuildProfilerLinuxIntegrationTests"
1172+
1173+
- task: DockerCompose@0
1174+
displayName: docker-compose run --no-deps ProfilerIntegrationTests
1175+
inputs:
1176+
containerregistrytype: Container Registry
1177+
dockerComposeFileArgs: |
1178+
baseImage=$(baseImage)
1179+
dockerComposeCommand: run --no-deps --rm -e baseImage=$(baseImage) -e IncludeTestsRequiringDocker=false ProfilerIntegrationTests
1180+
projectName: ddtrace_$(Build.BuildNumber)
1181+
1182+
- publish: profiler/build_data
1183+
artifact: continuous-profiler-logs_integration_tests_linux_$(baseImage)_$(System.JobAttempt)
1184+
condition: succeededOrFailed()
1185+
continueOnError: true
1186+
1187+
- task: PublishTestResults@2
1188+
displayName: publish test results
1189+
inputs:
1190+
testResultsFormat: VSTest
1191+
testResultsFiles: profiler/build_data/results/**/*.trx
1192+
condition: succeededOrFailed()
1193+
11251194
- stage: integration_tests_arm64
11261195
condition: and(succeeded(), eq(variables['isScheduledBuild'], 'False'))
11271196
dependsOn: [build_arm64, master_commit_id]
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: 'Run in docker'
2+
description: 'Run command in docker'
3+
4+
inputs:
5+
command:
6+
descritption: 'Command to run'
7+
default: ''
8+
9+
runs:
10+
using: "composite"
11+
steps:
12+
- name: Build on Debian Docker image
13+
shell: bash
14+
run: |
15+
docker build \
16+
--build-arg DOTNETSDK_VERSION=6.0.100 \
17+
--tag dd-trace-dotnet/debian-builder \
18+
--target builder \
19+
--file "${GITHUB_WORKSPACE}/tracer/build/_build/docker/debian.dockerfile" \
20+
"${GITHUB_WORKSPACE}/tracer/build/_build"
21+
22+
- name: Run '${{ inputs.command }}' in Docker
23+
shell: bash
24+
run: |
25+
docker run --rm \
26+
--mount type=bind,source="${GITHUB_WORKSPACE}",target=/project \
27+
--env NugetPackageDirectory=/project/packages \
28+
--env tracerHome=/project/shared/bin/monitoring-home/tracer \
29+
--env artifacts=/project/tracer/src/bin/artifacts \
30+
--env DD_CLR_ENABLE_NGEN=1 \
31+
--env Verify_DisableClipboard=true \
32+
--env DiffEngine_Disabled=true \
33+
--env TestAllPackageVersions=false \
34+
--env IncludeMinorPackageVersions=false \
35+
--env NUGET_ENABLE_EXPERIMENTAL_HTTP_RETRY=true \
36+
dd-trace-dotnet/debian-builder \
37+
dotnet /build/bin/Debug/_build.dll ${{ inputs.command }}

.github/workflows/profiler-pipeline.yml

Lines changed: 24 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -39,106 +39,28 @@ jobs:
3939
runs-on: ubuntu-18.04
4040

4141
steps:
42-
- name: Install uuid-dev
43-
run: sudo apt-get install -y uuid-dev
44-
4542
- name: Clone dd-trace-dotnet repository
4643
uses: actions/checkout@v2
4744

48-
- name: Build Managed Loader
49-
run: dotnet build -c Release shared/src/managed-lib/ManagedLoader/Datadog.AutoInstrumentation.ManagedLoader.csproj
50-
51-
- name: Build Managed Profiler Engine
52-
run: dotnet build -c Release profiler/src/ProfilerEngine/Datadog.Profiler.Managed/Datadog.Profiler.Managed.csproj
53-
54-
- name: Build Native Profiler Engine and Tests
55-
run: |
56-
CXX=clang++ CC=clang cmake -S profiler -B __build
57-
cmake --build __build --config Release --parallel
58-
59-
- name: Run Managed Unit tests
60-
shell: bash
61-
run: ./.github/scripts/run-managed-unit-tests.sh profiler/test Release
45+
- uses: ./.github/actions/run-in-docker
46+
name: Build Monitoring Home in Docker
47+
with:
48+
command: "Clean BuildTracerHome BuildNativeLoader BuildProfilerHome ZipMonitoringHome --TracerHome /project/shared/bin/monitoring-home"
6249

6350
- name: Run Native Unit tests
6451
shell: bash
6552
run: |
6653
sudo mkdir /var/log/datadog
6754
sudo chmod 777 /var/log/datadog
68-
cd __build
69-
ctest --output-on-failure
70-
71-
- name: Prepare environment to run the application
72-
run: |
73-
echo "PROFILER_OUTPUT_DIR=$(realpath ./profiler)/_build" >> $GITHUB_ENV
55+
sudo chmod +x ./profiler/_build/bin/Datadog.Profiler.Native.Tests/Datadog.Profiler.Native.Tests
56+
./profiler/_build/bin/Datadog.Profiler.Native.Tests/Datadog.Profiler.Native.Tests --gtest_output=xml
7457
7558
- name: Publish artifact
7659
uses: actions/upload-artifact@v2
7760
with:
7861
if-no-files-found: error
79-
name: DDProf-Deploy.Linux.Release.x64
80-
path: '${{ env.PROFILER_OUTPUT_DIR }}/DDProf-Deploy'
81-
retention-days: 7
82-
83-
test_linux_profiler_x64:
84-
name: STests Linux Profiler (x64, Release)
85-
runs-on: ubuntu-latest
86-
needs: build_linux_release_x64
87-
88-
steps:
89-
- name: Clone dd-trace-dotnet repository
90-
uses: actions/checkout@v2
91-
92-
- name: Download profiler artifact
93-
uses: actions/download-artifact@v2
94-
with:
95-
name: DDProf-Deploy.Linux.Release.x64
96-
path: DDProf-Deploy
97-
98-
- name: Build sample applications
99-
run: dotnet build -c Release profiler/src/Demos/Datadog.Demos.sln -p:Platform=x64
100-
101-
- name: Prepare environment to run the application
102-
run: |
103-
# download and setup dotnet-dump
104-
mkdir tools
105-
curl -o tools/dotnet-dump -L https://aka.ms/dotnet-dump/linux-x64
106-
chmod +x tools/dotnet-dump
107-
108-
echo "$(realpath .)/tools" >> $GITHUB_PATH
109-
110-
#
111-
# set profiler deployment and test output dir folder path for the test
112-
#
113-
echo "DD_TESTING_PROFILER_FOLDER=$(realpath .)/DDProf-Deploy" >> $GITHUB_ENV
114-
# create
115-
tests_output_dir=$(realpath .)/tests_output
116-
mkdir $tests_output_dir
117-
echo "DD_TESTING_OUPUT_DIR=$tests_output_dir" >> $GITHUB_ENV
118-
119-
- name: Run Integration tests
120-
env:
121-
DD_API_KEY: '${{ secrets.DD_API_KEY }}'
122-
run: |
123-
cd profiler/test/Datadog.Profiler.IntegrationTests &&
124-
LD_PRELOAD=${DD_TESTING_PROFILER_FOLDER}/Datadog.Linux.ApiWrapper.x64.so dotnet test -c Release -p:Platform=x64 --logger "trx" -- RunConfiguration.TreatNoTestsAsError=true
125-
126-
- name: Generate tests report
127-
uses: dorny/test-reporter@v1
128-
if: '${{ always() }}'
129-
with:
130-
name: STests Linux x64 report
131-
path: profiler/test/Datadog.Profiler.IntegrationTests/TestResults/*.trx
132-
reporter: dotnet-trx
133-
134-
- name: 'Publish Tests result, Logs and PProf files'
135-
uses: actions/upload-artifact@v2
136-
if: '${{ always() }}'
137-
with:
138-
if-no-files-found: error
139-
name: Tests_result_logs_and_pprofs_files.Linux.Release.x64
140-
path: |
141-
${{ env.DD_TESTING_OUPUT_DIR }}
62+
name: monitoring-home.Linux.Release.x64
63+
path: '${{ github.workspace }}/shared/bin/monitoring-home'
14264
retention-days: 7
14365

14466
benchmark_linux_x64:
@@ -169,8 +91,8 @@ jobs:
16991
- name: Download profiler artifact
17092
uses: actions/download-artifact@v2
17193
with:
172-
name: DDProf-Deploy.Linux.Release.x64
173-
path: DDProf-Deploy
94+
name: monitoring-home.Linux.Release.x64
95+
path: shared/bin/monitoring-home
17496

17597
- name: Setup Go 1.16.8
17698
uses: actions/setup-go@v2
@@ -185,6 +107,8 @@ jobs:
185107
go_tool_dir=$(realpath .)/tools
186108
mkdir $go_tool_dir
187109
echo "GOPATH=$go_tool_dir" >> $GITHUB_ENV
110+
sudo mkdir -p /var/log/datadog/dotnet
111+
sudo chmod 777 /var/log/datadog/dotnet
188112
189113
- name: Install timeit
190114
run: go install github.com/tonyredondo/timeit@latest
@@ -200,6 +124,14 @@ jobs:
200124
- name: Wait 20 seconds to agent flush before finishing pipeline
201125
run: sleep 20
202126

127+
- name: Publish artifact
128+
uses: actions/upload-artifact@v2
129+
with:
130+
if-no-files-found: error
131+
name: Benchmark.tests.linux.${{ matrix.framework }}.logs
132+
path: '/var/log/datadog/dotnet'
133+
retention-days: 7
134+
203135
build_linux_asan:
204136
name: Build Linux Profiler ASAN
205137
runs-on: ubuntu-latest
@@ -372,14 +304,6 @@ jobs:
372304
path: 'shared\bin\monitoring-home'
373305
retention-days: 7
374306

375-
- name: Publish artifact profiler-home
376-
uses: actions/upload-artifact@v2
377-
with:
378-
if-no-files-found: error
379-
name: 'profiler-home.Windows.${{matrix.configuration}}'
380-
path: 'shared\bin\monitoring-home\continuousprofiler'
381-
retention-days: 7
382-
383307

384308
test_windows_profiler:
385309
name: STests Windows Profiler
@@ -406,7 +330,7 @@ jobs:
406330
uses: actions/download-artifact@v2
407331
with:
408332
name: monitoring-home.Windows.${{matrix.configuration}}
409-
path: DDProf-Deploy
333+
path: shared/bin/monitoring-home
410334

411335
- name: Build sample applications
412336
run: dotnet build -c ${{matrix.configuration}} profiler/src/Demos/Datadog.Demos.sln -p:Platform=${{matrix.platform}}
@@ -422,14 +346,11 @@ jobs:
422346
#
423347
# set profiler deployment and test output dir folder path for the test
424348
#
425-
echo "DD_TESTING_PROFILER_FOLDER=$(Join-Path -Path $(Resolve-Path .) -ChildPath DDProf-Deploy)" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
349+
echo "MonitoringHomeDirectory=$(Join-Path -Path $(Resolve-Path .) -ChildPath shared/bin/monitoring-home)" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
426350
echo "DD_TESTING_OUPUT_DIR=$(Join-Path -Path $(Resolve-Path .) -ChildPath tests_output)" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
427351
428352
- name: Run Integration tests
429353
shell: cmd
430-
env:
431-
DD_API_KEY: '${{ secrets.DD_API_KEY }}'
432-
USE_NATIVE_LOADER: 'true'
433354
run: >
434355
cd profiler/test/Datadog.Profiler.IntegrationTests &&
435356
dotnet test -c ${{matrix.configuration}} -p:Platform=${{matrix.platform}} --logger "console;verbosity=detailed" --logger "trx" -- RunConfiguration.TreatNoTestsAsError=true
@@ -815,8 +736,8 @@ jobs:
815736
- name: Download profiler artifact
816737
uses: actions/download-artifact@v2
817738
with:
818-
name: DDProf-Deploy.Linux.Release.x64
819-
path: profiler-home-linux
739+
name: monitoring-home.Linux.Release.x64
740+
path: monitoring-home-linux
820741

821742
- name: Run throughput tests
822743
shell: bash

0 commit comments

Comments
 (0)