Skip to content

Commit 1f40b0d

Browse files
authored
System.Net Stress Tests Improvements 2 (#108703)
- replace docker-compose with docker compose on windows (removew workaround for actions/runner-images#7080) - Add -nobuild option to run-docker-compose.ps1/sh script to simplify running without building the images - remove version field from docker-compose.yml files to avoid triggering warnings - Add mount for crash dumps collections on ssl stress tests
1 parent 670401f commit 1f40b0d

File tree

6 files changed

+55
-65
lines changed

6 files changed

+55
-65
lines changed

eng/pipelines/libraries/stress/http.yml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,6 @@ extends:
100100
variables:
101101
DUMPS_SHARE_MOUNT_ROOT: "C:/dumps-share"
102102
DUMPS_SHARE: "$(Build.ArtifactStagingDirectory)/dumps/"
103-
104-
# The 1es-windows-2022-open image has an issue where the Chocolatey-installed V1 docker-compose takes precendence over the
105-
# V2 docker-compose required by the stress tests, see: https://github.com/actions/runner-images/issues/7080
106-
# This is worked around by handpicking the V2 executable.
107-
# The workaround should be removed when the official fix is propagated into 1es-windows-2022-open, or when we switch to another image.
108-
DOCKER_COMPOSE_CMD: "C:/ProgramData/docker/cli-plugins/docker-compose.exe"
109103
pool:
110104
name: $(DncEngPublicBuildPool)
111105
demands: ImageOverride -equals 1es-windows-2022-open
@@ -140,7 +134,7 @@ extends:
140134
$env:STRESS_CLIENT_ARGS = "$env:HTTPSTRESS_CLIENT_ARGS -http 3.0"
141135
$env:STRESS_SERVER_ARGS = "$env:HTTPSTRESS_SERVER_ARGS -http 3.0"
142136
New-Item -Force $env:DUMPS_SHARE -ItemType Directory
143-
& $env:DOCKER_COMPOSE_CMD up --abort-on-container-exit --no-color
137+
docker compose up --abort-on-container-exit --no-color
144138
displayName: Run HttpStress - HTTP 3.0
145139
condition: and(eq(variables['buildRuntime.succeeded'], 'true'), eq(variables['buildStress.succeeded'], 'true'))
146140
@@ -149,7 +143,7 @@ extends:
149143
$env:STRESS_CLIENT_ARGS = "$env:HTTPSTRESS_CLIENT_ARGS -http 2.0"
150144
$env:STRESS_SERVER_ARGS = "$env:HTTPSTRESS_SERVER_ARGS -http 2.0"
151145
New-Item -Force $env:DUMPS_SHARE -ItemType Directory
152-
& $env:DOCKER_COMPOSE_CMD up --abort-on-container-exit --no-color
146+
docker compose up --abort-on-container-exit --no-color
153147
displayName: Run HttpStress - HTTP 2.0
154148
condition: and(eq(variables['buildRuntime.succeeded'], 'true'), eq(variables['buildStress.succeeded'], 'true'))
155149
@@ -158,7 +152,7 @@ extends:
158152
$env:STRESS_CLIENT_ARGS = "$env:HTTPSTRESS_CLIENT_ARGS -http 1.1"
159153
$env:STRESS_SERVER_ARGS = "$env:HTTPSTRESS_SERVER_ARGS -http 1.1"
160154
New-Item -Force $env:DUMPS_SHARE -ItemType Directory
161-
& $env:DOCKER_COMPOSE_CMD up --abort-on-container-exit --no-color
155+
docker compose up --abort-on-container-exit --no-color
162156
displayName: Run HttpStress - HTTP 1.1
163157
condition: and(eq(variables['buildRuntime.succeeded'], 'true'), eq(variables['buildStress.succeeded'], 'true'))
164158

eng/pipelines/libraries/stress/ssl.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,6 @@ extends:
7575
variables:
7676
DUMPS_SHARE_MOUNT_ROOT: "C:/dumps-share"
7777
DUMPS_SHARE: "$(Build.ArtifactStagingDirectory)/dumps/"
78-
# The 1es-windows-2022-open image has an issue where the Chocolatey-installed V1 docker-compose takes precendence over the
79-
# V2 docker-compose required by the stress tests, see: https://github.com/actions/runner-images/issues/7080
80-
# This is worked around by handpicking the V2 executable.
81-
# The workaround should be removed when the official fix is propagated into 1es-windows-2022-open, or when we switch to another image.
82-
DOCKER_COMPOSE_CMD: "C:/ProgramData/docker/cli-plugins/docker-compose.exe"
8378
steps:
8479
- checkout: self
8580
clean: true
@@ -99,7 +94,7 @@ extends:
9994
$env:STRESS_CLIENT_ARGS = $env:SSLSTRESS_CLIENT_ARGS
10095
$env:STRESS_SERVER_ARGS = $env:SSLSTRESS_SERVER_ARGS
10196
New-Item -Force $env:DUMPS_SHARE -ItemType Directory
102-
& $env:DOCKER_COMPOSE_CMD up --abort-on-container-exit --no-color
97+
docker compose up --abort-on-container-exit --no-color
10398
displayName: Run SslStress
10499
105100
- publish: $(Build.ArtifactStagingDirectory)/dumps

src/libraries/Common/tests/System/Net/StressTests/run-docker-compose.ps1

Lines changed: 30 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Param(
99
[switch][Alias('b')]$buildCurrentLibraries, # Drives the stress test using libraries built from current source
1010
[switch][Alias('pa')]$privateAspNetCore, # Drive the stress test using a private Asp.Net Core package, requires -b to be set
1111
[switch][Alias('o')]$buildOnly, # Build, but do not run the stress app
12+
[switch][Alias('n')]$noBuild, # Do not build the docker image
1213
[string][Alias('t')]$sdkImageName = "dotnet-sdk-libs-current", # Name of the sdk image name, if built from source.
1314
[string]$clientStressArgs = "",
1415
[string]$serverStressArgs = "",
@@ -20,23 +21,12 @@ $COMPOSE_FILE = "$TestProjectDir/docker-compose.yml"
2021
[xml]$xml = Get-Content (Join-Path $RepoRoot "eng\Versions.props")
2122
$VERSION = "$($xml.Project.PropertyGroup.MajorVersion[0]).$($xml.Project.PropertyGroup.MinorVersion[0])"
2223

23-
# This is a workaround for an issue with 1es-windows-2022-open, which should be eventually removed.
24-
# See comments in <repo>/eng/pipelines/libraries/stress/ssl.yml for more info.
25-
$dockerComposeCmd = $env:DOCKER_COMPOSE_CMD
26-
if (!(Test-Path $dockerComposeCmd -ErrorAction SilentlyContinue)) {
27-
$dockerComposeCmd = "docker-compose"
28-
}
29-
3024
if (!$dumpsSharePath) {
3125
$dumpsSharePath = "$TestProjectDir/dumps"
3226
}
3327

3428
# Build runtime libraries and place in a docker image
3529
if ($buildCurrentLibraries) {
36-
if ([string]::IsNullOrEmpty($sdkImageName)) {
37-
$sdkImageName = "dotnet-sdk-libs-current"
38-
}
39-
4030
$LIBRARIES_BUILD_ARGS = " -t $sdkImageName -c $configuration"
4131
if ($useWindowsContainers) {
4232
$LIBRARIES_BUILD_ARGS += " -w"
@@ -55,46 +45,46 @@ elseif ($privateAspNetCore) {
5545
exit 1
5646
}
5747

58-
# Dockerize the stress app using docker-compose
59-
$BuildArgs = @(
60-
"--build-arg", "VERSION=$Version",
61-
"--build-arg", "CONFIGURATION=$configuration"
62-
)
63-
if (![string]::IsNullOrEmpty($sdkImageName)) {
64-
$BuildArgs += "--build-arg", "SDK_BASE_IMAGE=$sdkImageName"
65-
}
6648
if ($useWindowsContainers) {
6749
$env:DOCKERFILE = "windows.Dockerfile"
6850
}
6951

70-
$originalErrorPreference = $ErrorActionPreference
71-
$ErrorActionPreference = 'Continue'
72-
try {
73-
write-output "$dockerComposeCmd --log-level DEBUG --file $COMPOSE_FILE build $buildArgs"
74-
& $dockerComposeCmd --log-level DEBUG --file $COMPOSE_FILE build @buildArgs 2>&1 | ForEach-Object { "$_" }
75-
if ($LASTEXITCODE -ne 0) {
76-
throw "docker-compose exited with error code $LASTEXITCODE"
52+
if (!$noBuild) {
53+
# Dockerize the stress app using docker-compose
54+
$BuildArgs = @(
55+
"--build-arg", "VERSION=$Version",
56+
"--build-arg", "CONFIGURATION=$configuration"
57+
)
58+
if ($sdkImageName) {
59+
$BuildArgs += "--build-arg", "SDK_BASE_IMAGE=$sdkImageName"
60+
}
61+
$originalErrorPreference = $ErrorActionPreference
62+
$ErrorActionPreference = 'Continue'
63+
try {
64+
write-output "docker compose --file $COMPOSE_FILE build $buildArgs"
65+
docker compose --file $COMPOSE_FILE build @buildArgs 2>&1
66+
if ($LASTEXITCODE -ne 0) {
67+
throw "docker compose exited with error code $LASTEXITCODE"
68+
}
69+
}
70+
finally {
71+
$ErrorActionPreference = $originalErrorPreference
7772
}
78-
}
79-
finally {
80-
$ErrorActionPreference = $originalErrorPreference
8173
}
8274

8375
# Run the stress app
8476
if (!$buildOnly) {
85-
if ($dumpsSharePath) {
86-
if ($useWindowsContainers) {
87-
$env:DUMPS_SHARE_MOUNT_ROOT = "C:/dumps-share"
88-
}
89-
else {
90-
$env:DUMPS_SHARE_MOUNT_ROOT = "/dumps-share"
91-
}
92-
93-
$env:DUMPS_SHARE = $dumpsSharePath
94-
New-Item -Force $env:DUMPS_SHARE -ItemType Directory
77+
if ($useWindowsContainers) {
78+
$env:DUMPS_SHARE_MOUNT_ROOT = "C:/dumps-share"
9579
}
80+
else {
81+
$env:DUMPS_SHARE_MOUNT_ROOT = "/dumps-share"
82+
}
83+
84+
$env:DUMPS_SHARE = $dumpsSharePath
85+
New-Item -Force $env:DUMPS_SHARE -ItemType Directory
9686

9787
$env:STRESS_CLIENT_ARGS = $clientStressArgs
9888
$env:STRESS_SERVER_ARGS = $serverStressArgs
99-
& $dockerComposeCmd --file "$COMPOSE_FILE" up --abort-on-container-exit
89+
docker compose --file "$COMPOSE_FILE" up --abort-on-container-exit
10090
}

src/libraries/Common/tests/System/Net/StressTests/run-docker-compose.sh

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,12 @@ imagename="dotnet-sdk-libs-current"
2828
configuration="Release"
2929
buildcurrentlibraries=0
3030
buildonly=0
31+
nobuild=0
3132
clientstressargs=""
3233
serverstressargs=""
3334

3435
projectdir=$1
36+
shift 1
3537
if [[ ! -d "$projectdir" ]]; then
3638
echo "First argument must be path to the stress project directory"
3739
exit 1
@@ -40,7 +42,7 @@ fi
4042
dumpssharepath="$projectdir/dumps"
4143

4244
while [[ $# > 0 ]]; do
43-
opt="$(echo "${1/#--/-}" | tr "[:upper:]" "[:lower:]")"
45+
opt="$(printf "%s" "${1/#--/-}" | tr "[:upper:]" "[:lower:]")"
4446
case "$opt" in
4547
-dumpssharepath|-d)
4648
dumpssharepath=$2
@@ -62,6 +64,10 @@ while [[ $# > 0 ]]; do
6264
buildonly=1
6365
shift 1
6466
;;
67+
-nobuild|-n)
68+
nobuild=1
69+
shift 1
70+
;;
6571
-clientstressargs)
6672
clientstressargs=$2
6773
shift 2
@@ -86,15 +92,17 @@ if [[ "$buildcurrentlibraries" -eq 1 ]]; then
8692
fi
8793
fi
8894

89-
build_args="--build-arg VERSION=$version --build-arg CONFIGURATION=$configuration"
90-
if [[ -n "$imagename" ]]; then
91-
build_args="$build_args --build-arg SDK_BASE_IMAGE=$imagename"
92-
fi
93-
9495
compose_file="$projectdir/docker-compose.yml"
9596

96-
if ! docker-compose --file "$compose_file" build $build_args; then
97-
exit $?
97+
if [[ "$nobuild" -eq 0 ]]; then
98+
build_args="--build-arg VERSION=$version --build-arg CONFIGURATION=$configuration"
99+
if [[ -n "$imagename" ]]; then
100+
build_args="$build_args --build-arg SDK_BASE_IMAGE=$imagename"
101+
fi
102+
103+
if ! docker-compose --file "$compose_file" build $build_args; then
104+
exit $?
105+
fi
98106
fi
99107

100108
if [[ "$buildonly" -eq 0 ]]; then

src/libraries/System.Net.Http/tests/StressTests/HttpStress/docker-compose.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
version: '3'
21
services:
32
client:
43
build:

src/libraries/System.Net.Security/tests/StressTests/SslStress/docker-compose.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
version: '3'
1+
version: '3' # Although the version attribute is obsolete and should be ignored, it's seemingly not the case on Build.Ubuntu.2204.Amd64.Open
22
services:
33
client:
44
build:
55
context: ../../../../ # ~> src/libraries
66
dockerfile: ./System.Net.Security/tests/StressTests/SslStress/${DOCKERFILE:-Dockerfile}
7+
volumes:
8+
- "${DUMPS_SHARE}:${DUMPS_SHARE_MOUNT_ROOT}"
79
links:
810
- server
911
environment:
@@ -12,6 +14,8 @@ services:
1214
build:
1315
context: ../../../../ # ~> src/libraries
1416
dockerfile: ./System.Net.Security/tests/StressTests/SslStress/${DOCKERFILE:-Dockerfile}
17+
volumes:
18+
- "${DUMPS_SHARE}:${DUMPS_SHARE_MOUNT_ROOT}"
1519
ports:
1620
- "5001:5001"
1721
environment:

0 commit comments

Comments
 (0)