Skip to content

Commit 5d874be

Browse files
authored
Run stress tests on private Asp.Net Core package (#33860)
Currently, it's possible to run stress tests on privately built CoreCLR and libraries by executing load-corefx-testhost.ps1 -b followed by run-docker-compose.ps1 -b. However, it was not possible to run the stress server on a private Asp.Net Core package which is used for private libraries build. This PR adds a new -pa parameter to run-docker-compose.ps1 which builds a server container with a private Asp.Net Core package version.
1 parent d0c892d commit 5d874be

File tree

5 files changed

+116
-2
lines changed

5 files changed

+116
-2
lines changed

eng/docker/build-docker-sdk.ps1

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
Param(
77
[string][Alias('t')]$imageName = "dotnet-sdk-libs-current",
88
[string][Alias('c')]$configuration = "Release",
9-
[switch][Alias('w')]$buildWindowsContainers
9+
[switch][Alias('w')]$buildWindowsContainers,
10+
[switch][Alias('pa')]$privateAspNetCore
1011
)
1112

1213
$ErrorActionPreference = "Stop"
@@ -22,17 +23,38 @@ if ($buildWindowsContainers)
2223
& "$REPO_ROOT_DIR/libraries.cmd" -ci -c $configuration -runtimeConfiguration release
2324

2425
# Dockerize the build artifacts
25-
docker build --tag $imageName `
26+
if($privateAspNetCore)
27+
{
28+
docker build --tag $imageName `
29+
--build-arg CONFIGURATION=$configuration `
30+
--build-arg TESTHOST_LOCATION=. `
31+
--file "$PSScriptRoot/libraries-sdk-aspnetcore.windows.Dockerfile" `
32+
"$REPO_ROOT_DIR/artifacts/bin/testhost"
33+
}
34+
else
35+
{
36+
docker build --tag $imageName `
2637
--build-arg CONFIGURATION=$configuration `
2738
--build-arg TESTHOST_LOCATION=. `
2839
--file "$PSScriptRoot/libraries-sdk.windows.Dockerfile" `
2940
"$REPO_ROOT_DIR/artifacts/bin/testhost"
41+
}
3042
}
3143
else
3244
{
3345
# Docker build libraries and copy to dotnet sdk image
46+
if($privateAspNetCore)
47+
{
48+
docker build --tag $imageName `
49+
--build-arg CONFIGURATION=$configuration `
50+
--file "$PSScriptRoot/libraries-sdk-aspnetcore.linux.Dockerfile" `
51+
$REPO_ROOT_DIR
52+
}
53+
else
54+
{
3455
docker build --tag $imageName `
3556
--build-arg CONFIGURATION=$configuration `
3657
--file "$PSScriptRoot/libraries-sdk.linux.Dockerfile" `
3758
$REPO_ROOT_DIR
59+
}
3860
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Builds and copies library artifacts into target dotnet sdk image
2+
ARG BUILD_BASE_IMAGE=mcr.microsoft.com/dotnet-buildtools/prereqs:centos-7-f39df28-20191023143754
3+
ARG SDK_BASE_IMAGE=mcr.microsoft.com/dotnet/core/sdk:3.0.100-buster
4+
5+
FROM $BUILD_BASE_IMAGE as corefxbuild
6+
7+
WORKDIR /repo
8+
COPY . .
9+
10+
ARG CONFIGURATION=Release
11+
RUN ./src/coreclr/build.sh -release -skiptests -clang9 && \
12+
./libraries.sh -c $CONFIGURATION -runtimeconfiguration release
13+
14+
FROM $SDK_BASE_IMAGE as target
15+
16+
ARG TESTHOST_LOCATION=/repo/artifacts/bin/testhost
17+
ARG TFM=netcoreapp5.0
18+
ARG OS=Linux
19+
ARG ARCH=x64
20+
ARG CONFIGURATION=Release
21+
22+
ARG COREFX_SHARED_FRAMEWORK_NAME=Microsoft.NETCore.App
23+
ARG ASPNETCORE_SHARED_NAME=Microsoft.AspNetCore.App
24+
ARG SOURCE_COREFX_VERSION=5.0.0
25+
ARG TARGET_SHARED_FRAMEWORK=/usr/share/dotnet/shared
26+
ARG TARGET_COREFX_VERSION=3.0.0
27+
28+
COPY --from=corefxbuild \
29+
$TESTHOST_LOCATION/$TFM-$OS-$CONFIGURATION-$ARCH/shared/$COREFX_SHARED_FRAMEWORK_NAME/$SOURCE_COREFX_VERSION/* \
30+
$TARGET_SHARED_FRAMEWORK/$COREFX_SHARED_FRAMEWORK_NAME/$TARGET_COREFX_VERSION/
31+
COPY --from=corefxbuild \
32+
$TESTHOST_LOCATION/$TFM-$OS-$CONFIGURATION-$ARCH/shared/$COREFX_SHARED_FRAMEWORK_NAME/$SOURCE_COREFX_VERSION/* \
33+
$TARGET_SHARED_FRAMEWORK/$COREFX_SHARED_FRAMEWORK_NAME/$SOURCE_COREFX_VERSION/
34+
COPY --from=corefxbuild \
35+
$TESTHOST_LOCATION/$TFM-$OS-$CONFIGURATION-$ARCH/shared/$ASPNETCORE_SHARED_NAME/$SOURCE_COREFX_VERSION/* \
36+
$TARGET_SHARED_FRAMEWORK/$ASPNETCORE_SHARED_NAME/$TARGET_COREFX_VERSION/
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# escape=`
2+
# Simple Dockerfile which copies library build artifacts into target dotnet sdk image
3+
ARG SDK_BASE_IMAGE=mcr.microsoft.com/dotnet/core/sdk:3.0.100-nanoserver-1809
4+
FROM $SDK_BASE_IMAGE as target
5+
6+
ARG TESTHOST_LOCATION=".\\artifacts\\bin\\testhost"
7+
ARG TFM=netcoreapp5.0
8+
ARG OS=Windows_NT
9+
ARG ARCH=x64
10+
ARG CONFIGURATION=Release
11+
12+
ARG COREFX_SHARED_FRAMEWORK_NAME=Microsoft.NETCore.App
13+
ARG ASPNETCORE_SHARED_NAME=Microsoft.AspNetCore.App
14+
ARG SOURCE_COREFX_VERSION=5.0.0
15+
ARG TARGET_SHARED_FRAMEWORK="C:\\Program Files\\dotnet\\shared"
16+
ARG TARGET_COREFX_VERSION=3.0.0
17+
18+
COPY `
19+
$TESTHOST_LOCATION\$TFM-$OS-$CONFIGURATION-$ARCH\shared\$COREFX_SHARED_FRAMEWORK_NAME\$SOURCE_COREFX_VERSION\ `
20+
$TARGET_SHARED_FRAMEWORK\$COREFX_SHARED_FRAMEWORK_NAME\$TARGET_COREFX_VERSION\
21+
COPY `
22+
$TESTHOST_LOCATION\$TFM-$OS-$CONFIGURATION-$ARCH\shared\$COREFX_SHARED_FRAMEWORK_NAME\$SOURCE_COREFX_VERSION\ `
23+
$TARGET_SHARED_FRAMEWORK\$COREFX_SHARED_FRAMEWORK_NAME\$SOURCE_COREFX_VERSION\
24+
COPY `
25+
$TESTHOST_LOCATION\$TFM-$OS-$CONFIGURATION-$ARCH\shared\$ASPNETCORE_SHARED_NAME\$SOURCE_COREFX_VERSION\ `
26+
$TARGET_SHARED_FRAMEWORK\$ASPNETCORE_SHARED_NAME\$TARGET_COREFX_VERSION\

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Param(
66
[string][Alias('c')]$configuration = "Release", # Build configuration for libraries and stress suite
77
[switch][Alias('w')]$useWindowsContainers, # Use windows containers, if available
88
[switch][Alias('b')]$buildCurrentLibraries, # Drives the stress test using libraries built from current source
9+
[switch][Alias('pa')]$privateAspNetCore, # Drive the stress test using a private Asp.Net Core package, requires -b to be set
910
[switch][Alias('o')]$buildOnly, # Build, but do not run the stress app
1011
[string][Alias('t')]$sdkImageName, # Name of the sdk image name, if built from source.
1112
[string]$clientStressArgs = "",
@@ -19,16 +20,30 @@ $COMPOSE_FILE = "$PSScriptRoot/docker-compose.yml"
1920

2021
if ($buildCurrentLibraries)
2122
{
23+
if ([string]::IsNullOrEmpty($sdkImageName))
24+
{
25+
$sdkImageName = "dotnet-sdk-libs-current"
26+
}
27+
2228
$LIBRARIES_BUILD_ARGS = " -t $sdkImageName -c $configuration"
2329
if($useWindowsContainers)
2430
{
2531
$LIBRARIES_BUILD_ARGS += " -w"
2632
}
33+
if($privateAspNetCore)
34+
{
35+
$LIBRARIES_BUILD_ARGS += " -p"
36+
}
2737

2838
Invoke-Expression "& $REPO_ROOT_DIR/eng/docker/build-docker-sdk.ps1 $LIBRARIES_BUILD_ARGS"
2939

3040
if (!$?) { exit 1 }
3141
}
42+
elseif ($privateAspNetCore) {
43+
write-output "Using a private Asp.Net Core package (-pa) requires using privately built libraries. Please, enable it with -b switch."
44+
write-output "USAGE: . $($MyInvocation.InvocationName) -b -pa <args>"
45+
exit 1
46+
}
3247

3348
# Dockerize the stress app using docker-compose
3449

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Param(
66
[string][Alias('c')]$configuration = "Release", # Build configuration for libraries and stress suite
77
[switch][Alias('w')]$useWindowsContainers, # Use windows containers, if available
88
[switch][Alias('b')]$buildCurrentLibraries, # Drives the stress test using libraries built from current source
9+
[switch][Alias('pa')]$privateAspNetCore, # Drive the stress test using a private Asp.Net Core package, requires -b to be set
910
[switch][Alias('o')]$buildOnly, # Build, but do not run the stress app
1011
[string][Alias('t')]$sdkImageName, # Name of the sdk image name, if built from source.
1112
[string]$clientStressArgs = "",
@@ -19,16 +20,30 @@ $COMPOSE_FILE = "$PSScriptRoot/docker-compose.yml"
1920

2021
if ($buildCurrentLibraries)
2122
{
23+
if ([string]::IsNullOrEmpty($sdkImageName))
24+
{
25+
$sdkImageName = "dotnet-sdk-libs-current"
26+
}
27+
2228
$LIBRARIES_BUILD_ARGS = " -t $sdkImageName -c $configuration"
2329
if($useWindowsContainers)
2430
{
2531
$LIBRARIES_BUILD_ARGS += " -w"
2632
}
33+
if($privateAspNetCore)
34+
{
35+
$LIBRARIES_BUILD_ARGS += " -p"
36+
}
2737

2838
Invoke-Expression "& $REPO_ROOT_DIR/eng/docker/build-docker-sdk.ps1 $LIBRARIES_BUILD_ARGS"
2939

3040
if (!$?) { exit 1 }
3141
}
42+
elseif ($privateAspNetCore) {
43+
write-output "Using a private Asp.Net Core package (-pa) requires using privately built libraries. Please, enable it with -b switch."
44+
write-output "USAGE: . $($MyInvocation.InvocationName) -b -pa <args>"
45+
exit 1
46+
}
3247

3348
# Dockerize the stress app using docker-compose
3449

0 commit comments

Comments
 (0)