Skip to content

Commit c714d16

Browse files
authored
chore(CI): add ForceDebugRun variable for debug control system tests (#7528)
## Summary of changes Updated the test run script logic to check the value of `ForceDebugRun` and, if set to `true`, append the `--force-dd-trace-debug` flag to the test runner command, allowing for easier debugging of test runs. ## Reason for change System tests don't respect the `ForceDebugRun` flag. ## Implementation details Using the baked in functionality which allows enabling debug mode through args. https://github.com/DataDog/system-tests/blob/802e9bf232034d484ae4e3692e7612a4bb4f2016/conftest.py#L51 ## Test coverage https://dev.azure.com/datadoghq/dd-trace-dotnet/_build/results?buildId=187347&view=logs&j=6caa9f15-174e-5e5f-7fe6-e6c1716397bd ## Other details <!-- Fixes #{issue} --> <!-- ⚠️ Note: Where possible, please obtain 2 approvals prior to merging. Unless CODEOWNERS specifies otherwise, for external teams it is typically best to have one review from a team member, and one review from apm-dotnet. Trivial changes do not require 2 reviews. MergeQueue is NOT enabled in this repository. If you have write access to the repo, the PR has 1-2 approvals (see above), and all of the required checks have passed, you can use the Squash and Merge button to merge the PR. If you don't have write access, or you need help, reach out in the #apm-dotnet channel in Slack. -->
1 parent 4b99834 commit c714d16

File tree

1 file changed

+45
-38
lines changed

1 file changed

+45
-38
lines changed

.azure-pipelines/ultimate-pipeline.yml

Lines changed: 45 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ variables:
104104
DD_LOGGER_DD_SERVICE: dd-trace-dotnet
105105
DD_LOGGER_DD_ENV: CI
106106
DD_LOGGER_DD_TRACE_LOG_DIRECTORY: $(System.DefaultWorkingDirectory)/artifacts/build_data/infra_logs
107+
DD_TRACE_DEBUG: $[eq(variables['ForceDebugRun'], 'true')]
107108
DD_LOGGER_TF_BUILD: True
108109
DD_LOGGER_BUILD_BUILDID: $(Build.BuildId)
109110
DD_LOGGER_BUILD_DEFINITIONNAME: $(Build.DefinitionName)
@@ -405,7 +406,7 @@ stages:
405406
dependsOn: []
406407
pool:
407408
name: $(linuxX64Pool)
408-
409+
409410
steps:
410411
- template: steps/clone-repo.yml
411412
parameters:
@@ -862,7 +863,7 @@ stages:
862863
parameters:
863864
targetShaId: $(targetShaId)
864865
targetBranch: $(targetBranch)
865-
866+
866867
# Download _both_ musl and glibc if we're building the universal package
867868
# but only the musl package if we're building alpine package
868869
- template: steps/download-artifact.yml
@@ -1875,7 +1876,7 @@ stages:
18751876
where dotnet
18761877
displayName: 'Rename default dotnet.exe'
18771878
- template: steps/restore-working-directory.yml
1878-
1879+
18791880
- template: steps/install-msi.yml
18801881
parameters:
18811882
# Pin to a specific version of Azure Functions, as beyond this requires Azurite
@@ -1975,7 +1976,7 @@ stages:
19751976
- stage: static_analysis_tests_profiler
19761977
condition: >
19771978
and(
1978-
succeeded(),
1979+
succeeded(),
19791980
eq(dependencies.generate_variables.outputs['generate_variables_job.generate_variables_step.IsProfilerChanged'], 'True')
19801981
)
19811982
dependsOn: [merge_commit_id, generate_variables]
@@ -2428,7 +2429,7 @@ stages:
24282429
command: "BuildLinuxIntegrationTests --framework $(publishTargetFramework) --SampleName Samples.Amazon.Lambda.RuntimeSupport"
24292430
apiKey: $(DD_LOGGER_DD_API_KEY)
24302431
retryCountForRunCommand: 3
2431-
2432+
24322433
- script: |
24332434
# Include the serverless dockerfile
24342435
docker-compose -p $(DockerComposeProjectName) \
@@ -2813,7 +2814,7 @@ stages:
28132814
#address sanitizer tests
28142815
condition: >
28152816
and(
2816-
succeeded(),
2817+
succeeded(),
28172818
eq(dependencies.generate_variables.outputs['generate_variables_job.generate_variables_step.IsProfilerChanged'], 'True')
28182819
)
28192820
dependsOn: [merge_commit_id, generate_variables]
@@ -2857,7 +2858,7 @@ stages:
28572858
baseImage: debian
28582859
command: "BuildProfilerSampleForSanitiserTests -Framework net7.0"
28592860
apiKey: $(DD_LOGGER_DD_API_KEY)
2860-
2861+
28612862
- template: steps/run-in-docker.yml
28622863
parameters:
28632864
target: builder
@@ -2896,9 +2897,9 @@ stages:
28962897

28972898
- stage: ubsan_profiler_tests
28982899
#undefined behavior sanitizer tests
2899-
condition: >
2900+
condition: >
29002901
and(
2901-
succeeded(),
2902+
succeeded(),
29022903
eq(dependencies.generate_variables.outputs['generate_variables_job.generate_variables_step.IsProfilerChanged'], 'True')
29032904
)
29042905
dependsOn: [merge_commit_id, generate_variables]
@@ -2958,7 +2959,7 @@ stages:
29582959
#thread sanitizer tests
29592960
condition: >
29602961
and(
2961-
succeeded(),
2962+
succeeded(),
29622963
eq(dependencies.generate_variables.outputs['generate_variables_job.generate_variables_step.IsProfilerChanged'], 'True')
29632964
)
29642965
dependsOn: [merge_commit_id, generate_variables]
@@ -3010,7 +3011,7 @@ stages:
30103011
TestAllPackageVersions: true
30113012
IncludeMinorPackageVersions: $[eq(variables.perform_comprehensive_testing, 'true')]
30123013

3013-
3014+
30143015
jobs:
30153016
- template: steps/update-github-status-jobs.yml
30163017
parameters:
@@ -4223,7 +4224,7 @@ stages:
42234224
LABELS=$(curl -s -H "Authorization: token $GITHUB_TOKEN" \
42244225
"https://api.github.com/repos/DataDog/dd-trace-dotnet/pulls/$(System.PullRequest.PullRequestNumber)" \
42254226
| jq -r '.labels[].name')
4226-
4227+
42274228
if echo "$LABELS" | grep -q "docker_image_artifacts"; then
42284229
BRANCH_NAME="$(System.PullRequest.SourceBranch)"
42294230
REF="refs/heads/$BRANCH_NAME"
@@ -4281,7 +4282,7 @@ stages:
42814282
- job: Windows
42824283
dependsOn: create_github_token
42834284
variables:
4284-
GITHUB_APP_TOKEN: $[ dependencies.create_github_token.outputs['retrieve_github_token.GITHUB_APP_TOKEN'] ]
4285+
GITHUB_APP_TOKEN: $[ dependencies.create_github_token.outputs['retrieve_github_token.GITHUB_APP_TOKEN'] ]
42854286

42864287
timeoutInMinutes: 30
42874288

@@ -4675,32 +4676,32 @@ stages:
46754676
- template: steps/update-github-status-jobs.yml
46764677
parameters:
46774678
jobs: [compute_scenarios, tests]
4678-
4679+
46794680
- job: compute_scenarios
46804681
timeoutInMinutes: 60
46814682
displayName: Compute system-tests scenarios
46824683
pool:
46834684
vmImage: ubuntu-latest
4684-
4685+
46854686
steps:
46864687
- checkout: none
4687-
4688+
46884689
- task: UsePythonVersion@0
46894690
inputs:
46904691
versionSpec: '3.12'
46914692
displayName: Install python 3.12
46924693

46934694
- script: git clone --depth 1 https://github.com/DataDog/system-tests.git
46944695
displayName: Get system tests repo
4695-
4696+
46964697
- script: |
46974698
./build.sh -i runner
46984699
displayName: Install runner
46994700
workingDirectory: system-tests
4700-
4701+
47014702
- script: |
47024703
set -e
4703-
4704+
47044705
source venv/bin/activate
47054706
# Try to get each workflow to take 15 mins = 900s
47064707
PYTHONPATH=. python utils/scripts/compute-workflow-parameters.py dotnet -g "$(scenarioGroups)" -s "$(additionalScenarios)" -t 900 > out.txt
@@ -4710,7 +4711,7 @@ stages:
47104711
47114712
echo "Found scenario groups: $endtoend_scenario_groups"
47124713
echo "Found weblogs: $endtoend_weblogs"
4713-
4714+
47144715
# Write the weblogs to a file (for later use to generate the docker images)
47154716
python -c "import json; variants = json.loads('$endtoend_weblogs'); print('\n'.join(variants))" > /tmp/weblogs_list.txt
47164717
# Generate matrix and write to file
@@ -4735,7 +4736,7 @@ stages:
47354736
displayName: Generate scenarios matrix JSON
47364737
name: create_matrix
47374738
workingDirectory: system-tests
4738-
4739+
47394740
- template: steps/download-artifact.yml
47404741
parameters:
47414742
artifact: linux-packages-linux-x64
@@ -4752,14 +4753,14 @@ stages:
47524753
set -e
47534754
cd system-tests
47544755
mkdir -p ../docker-images
4755-
4756+
47564757
while read w; do
47574758
echo "------------------------------------"
47584759
echo "Building images for variant: $w"
47594760
echo "------------------------------------"
47604761
# Build the images. For example:
47614762
./build.sh dotnet --weblog-variant $w
4762-
4763+
47634764
# Save weblog variant image
47644765
docker save system_tests/weblog:latest -o ../docker-images/$w.tar
47654766
done < /tmp/weblogs_list.txt
@@ -4780,7 +4781,7 @@ stages:
47804781
pool:
47814782
vmImage: ubuntu-latest
47824783
dependsOn: compute_scenarios
4783-
4784+
47844785
strategy:
47854786
matrix: $[ dependencies.compute_scenarios.outputs['create_matrix.matrixJson'] ]
47864787

@@ -4794,7 +4795,7 @@ stages:
47944795

47954796
- script: git clone --depth 1 https://github.com/DataDog/system-tests.git
47964797
displayName: Get system tests repo
4797-
4798+
47984799
- template: steps/download-artifact.yml
47994800
parameters:
48004801
artifact: system-test-docker-images
@@ -4817,7 +4818,7 @@ stages:
48174818
- script: |
48184819
echo "Loading images for variant: $(WEBLOG_VARIANT)"
48194820
docker load -i "$(Build.SourcesDirectory)/$(WEBLOG_VARIANT).tar"
4820-
4821+
48214822
echo "Available Docker images after loading:"
48224823
docker images
48234824
displayName: Docker load the correct variant
@@ -4845,7 +4846,13 @@ stages:
48454846
# Replace ',' with ' +S ' and add initial +S prefix
48464847
SCENARIOS=$(SCENARIO)
48474848
SCENARIOS_TO_RUN="+S ${SCENARIOS//,/ +S }"
4848-
./run.sh $SCENARIOS_TO_RUN --splits=$(N) --group=$(I)
4849+
4850+
DEBUG_FLAG=""
4851+
if [[ "$(DD_TRACE_DEBUG)" == "True" ]]; then
4852+
DEBUG_FLAG="--force-dd-trace-debug"
4853+
fi
4854+
4855+
./run.sh $SCENARIOS_TO_RUN --splits=$(N) --group=$(I) $DEBUG_FLAG
48494856
workingDirectory: system-tests
48504857
displayName: Run tests
48514858
env:
@@ -4964,7 +4971,7 @@ stages:
49644971
smokeTestAppDir: "$(System.DefaultWorkingDirectory)/tracer/test/test-applications/regression/AspNetCoreSmokeTest"
49654972
pool:
49664973
name: $(linuxX64SmokePool)
4967-
4974+
49684975
steps:
49694976
- template: steps/clone-repo.yml
49704977
parameters:
@@ -4993,7 +5000,7 @@ stages:
49935000
parameters:
49945001
target: 'chiseled-smoke-tests'
49955002
snapshotPrefix: "smoke_test"
4996-
5003+
49975004
# Run the "dd-dotnet" installer smoke tests
49985005
- script: |
49995006
docker-compose -p $(DockerComposeProjectName) build \
@@ -5430,7 +5437,7 @@ stages:
54305437
mkdir -p artifacts/build_data/logs
54315438
displayName: create test data directories
54325439
5433-
# Run the "normal" installer smoke tests
5440+
# Run the "normal" installer smoke tests
54345441
- script: |
54355442
docker-compose -p $(DockerComposeProjectName) build \
54365443
--build-arg DOTNETSDK_VERSION=$(dotnetCoreSdkLatestVersionShort) \
@@ -5508,7 +5515,7 @@ stages:
55085515
artifact: $(linuxArtifacts)
55095516
path: $(smokeTestAppDir)/artifacts
55105517

5511-
# Run the "normal" installer smoke tests
5518+
# Run the "normal" installer smoke tests
55125519
- script: |
55135520
docker-compose -p $(DockerComposeProjectName) build \
55145521
--build-arg DOTNETSDK_VERSION=$(dotnetCoreSdkLatestVersionShort) \
@@ -5525,7 +5532,7 @@ stages:
55255532
parameters:
55265533
target: 'chiseled-smoke-tests'
55275534
snapshotPrefix: "smoke_test"
5528-
5535+
55295536
# Run the "dd-dotnet" installer smoke tests
55305537
- script: |
55315538
docker-compose -p $(DockerComposeProjectName) build \
@@ -5978,7 +5985,7 @@ stages:
59785985
smokeTestAppDir: "$(System.DefaultWorkingDirectory)/tracer/test/test-applications/regression/AspNetCoreSmokeTest"
59795986
pool:
59805987
vmImage: windows-2022
5981-
5988+
59825989
steps:
59835990
- template: steps/install-docker-compose-v1.yml
59845991
parameters:
@@ -6210,7 +6217,7 @@ stages:
62106217
snapshotOutputDir: "$(System.DefaultWorkingDirectory)/artifacts/build_data/snapshots"
62116218
pool:
62126219
vmImage: $(vmImage)
6213-
6220+
62146221
steps:
62156222
- template: steps/clone-repo.yml
62166223
parameters:
@@ -6263,7 +6270,7 @@ stages:
62636270
echo "##vso[task.setvariable variable=AGENT_PID]$agent_pid"
62646271
echo "Agent PID: $agent_pid, waiting for startup"
62656272
6266-
while ! nc -z localhost 8126; do
6273+
while ! nc -z localhost 8126; do
62676274
sleep 0.1 # wait for 1/10 of the second before check again
62686275
done
62696276
@@ -6299,10 +6306,10 @@ stages:
62996306
- script: |
63006307
echo "Dumping traces"
63016308
$(CURL_COMMAND) -o $(snapshotOutputDir)/smoke_test_traces.json "http://localhost:8126$(TRACE_DUMP_ENDPOINT)"
6302-
6309+
63036310
echo "Dumping stats"
63046311
$(CURL_COMMAND) -o $(snapshotOutputDir)/smoke_test_stats.json "http://localhost:8126$(STATS_DUMP_ENDPOINT)"
6305-
6312+
63066313
echo "Dumping all requests"
63076314
$(CURL_COMMAND) -o $(snapshotOutputDir)/smoke_test_requests.json "http://localhost:8126$(REQUESTS_DUMP_ENDPOINT)"
63086315
@@ -6344,7 +6351,7 @@ stages:
63446351
smokeTestAppDir: "$(System.DefaultWorkingDirectory)/tracer/test/test-applications/regression/AspNetCoreSmokeTest"
63456352
pool:
63466353
vmImage: ubuntu-latest
6347-
6354+
63486355
steps:
63496356
- template: steps/clone-repo.yml
63506357
parameters:

0 commit comments

Comments
 (0)