From f2b0bdc13156c4caea11c93ad3ef30dd98f54407 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marie=20P=C3=ADchov=C3=A1?= <11718369+ManickaP@users.noreply.github.com> Date: Tue, 8 Sep 2020 15:36:43 +0200 Subject: [PATCH] Fixed stress test pipeline and other issues. (#41513) --- eng/pipelines/libraries/stress/http.yml | 28 +++++++++++++++------- .../tests/StressTests/HttpStress/StressClient.cs | 22 ++++++++--------- .../StressTests/SslStress/Utils/ErrorAggregator.cs | 2 +- 3 files changed, 32 insertions(+), 20 deletions(-) diff --git a/eng/pipelines/libraries/stress/http.yml b/eng/pipelines/libraries/stress/http.yml index 88dbf42..80f0e12 100644 --- a/eng/pipelines/libraries/stress/http.yml +++ b/eng/pipelines/libraries/stress/http.yml @@ -34,21 +34,26 @@ jobs: - checkout: self clean: true fetchDepth: 5 - + - bash: | $(dockerfilesFolder)/build-docker-sdk.sh -t $(sdkBaseImage) -c $(BUILD_CONFIGURATION) + echo "##vso[task.setvariable variable=succeeded;isOutput=true]true" + name: buildRuntime displayName: Build CLR and Libraries - + - bash: | $(httpStressProject)/run-docker-compose.sh -o -c $(BUILD_CONFIGURATION) -t $(sdkBaseImage) + echo "##vso[task.setvariable variable=succeeded;isOutput=true]true" + name: buildStress displayName: Build HttpStress - + - bash: | cd '$(httpStressProject)' export HTTPSTRESS_CLIENT_ARGS="$HTTPSTRESS_CLIENT_ARGS -http 2.0" export HTTPSTRESS_SERVER_ARGS="$HTTPSTRESS_SERVER_ARGS -http 2.0" docker-compose up --abort-on-container-exit --no-color - displayName: Run HttpStress - HTTP/2 + displayName: Run HttpStress - HTTP 2.0 + condition: and(eq(variables['buildRuntime.succeeded'], 'true'), eq(variables['buildStress.succeeded'], 'true')) - bash: | cd '$(httpStressProject)' @@ -56,6 +61,7 @@ jobs: export HTTPSTRESS_SERVER_ARGS="$HTTPSTRESS_SERVER_ARGS -http 1.1" docker-compose up --abort-on-container-exit --no-color displayName: Run HttpStress - HTTP 1.1 + condition: and(eq(variables['buildRuntime.succeeded'], 'true'), eq(variables['buildStress.succeeded'], 'true')) - job: windows displayName: Docker NanoServer @@ -69,25 +75,31 @@ jobs: clean: true fetchDepth: 5 lfs: false - + - powershell: | $(dockerfilesFolder)/build-docker-sdk.ps1 -w -t $(sdkBaseImage) -c $(BUILD_CONFIGURATION) + echo "##vso[task.setvariable variable=succeeded;isOutput=true]true" + name: buildRuntime displayName: Build CLR and Libraries - + - powershell: | $(httpStressProject)/run-docker-compose.ps1 -w -o -c $(BUILD_CONFIGURATION) -t $(sdkBaseImage) + echo "##vso[task.setvariable variable=succeeded;isOutput=true]true" + name: buildStress displayName: Build HttpStress - + - powershell: | cd '$(httpStressProject)' $env:HTTPSTRESS_CLIENT_ARGS = "$env:HTTPSTRESS_CLIENT_ARGS -http 2.0" $env:HTTPSTRESS_SERVER_ARGS = "$env:HTTPSTRESS_SERVER_ARGS -http 2.0" docker-compose up --abort-on-container-exit --no-color displayName: Run HttpStress - HTTP 2.0 - + condition: and(eq(variables['buildRuntime.succeeded'], 'true'), eq(variables['buildStress.succeeded'], 'true')) + - powershell: | cd '$(httpStressProject)' $env:HTTPSTRESS_CLIENT_ARGS = "$env:HTTPSTRESS_CLIENT_ARGS -http 1.1" $env:HTTPSTRESS_SERVER_ARGS = "$env:HTTPSTRESS_SERVER_ARGS -http 1.1" docker-compose up --abort-on-container-exit --no-color displayName: Run HttpStress - HTTP 1.1 + condition: and(eq(variables['buildRuntime.succeeded'], 'true'), eq(variables['buildStress.succeeded'], 'true')) \ No newline at end of file diff --git a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/StressClient.cs b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/StressClient.cs index 142171d..60286d4 100644 --- a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/StressClient.cs +++ b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/StressClient.cs @@ -185,7 +185,7 @@ namespace HttpStress } catch (Exception e) { - _aggregator.RecordFailure(e, opIndex, stopwatch.Elapsed, taskNum: taskNum, iteration: i); + _aggregator.RecordFailure(e, opIndex, stopwatch.Elapsed, requestContext.IsCancellationRequested, taskNum: taskNum, iteration: i); } } @@ -222,12 +222,12 @@ namespace HttpStress // Representative error text of stress failure public string ErrorText { get; } // Operation id => failure timestamps - public Dictionary> Failures { get; } + public Dictionary> Failures { get; } public StressFailureType(string errorText) { ErrorText = errorText; - Failures = new Dictionary>(); + Failures = new Dictionary>(); } public int FailureCount => Failures.Values.Select(x => x.Count).Sum(); @@ -272,7 +272,7 @@ namespace HttpStress _latencies.Add(elapsed.TotalMilliseconds); } - public void RecordFailure(Exception exn, int operationIndex, TimeSpan elapsed, int taskNum, long iteration) + public void RecordFailure(Exception exn, int operationIndex, TimeSpan elapsed, bool isCancelled, int taskNum, long iteration) { DateTime timestamp = DateTime.Now; @@ -293,13 +293,13 @@ namespace HttpStress lock (failureType) { - if(!failureType.Failures.TryGetValue(operationIndex, out List<(DateTime timestamp, TimeSpan duration)>? timestamps)) + if(!failureType.Failures.TryGetValue(operationIndex, out List<(DateTime timestamp, TimeSpan duration, bool isCancelled)>? details)) { - timestamps = new List<(DateTime timestamp, TimeSpan duration)>(); - failureType.Failures.Add(operationIndex, timestamps); + details = new List<(DateTime timestamp, TimeSpan duration, bool isCancelled)>(); + failureType.Failures.Add(operationIndex, details); } - timestamps.Add((timestamp, elapsed)); + details.Add((timestamp, elapsed, isCancelled)); } (Type exception, string message, string callSite)[] ClassifyFailure(Exception exn) @@ -439,7 +439,7 @@ namespace HttpStress Console.WriteLine(failure.ErrorText); Console.WriteLine(); Console.ForegroundColor = ConsoleColor.Yellow; - foreach (KeyValuePair> operation in failure.Failures) + foreach (KeyValuePair> operation in failure.Failures) { Console.ForegroundColor = ConsoleColor.Cyan; Console.Write($"\t{_operationNames[operation.Key].PadRight(30)}"); @@ -448,7 +448,7 @@ namespace HttpStress Console.Write("Fail: "); Console.ResetColor(); Console.Write(operation.Value.Count); - Console.WriteLine($"\tTimestamps: {string.Join(", ", operation.Value.Select(x => $"{x.timestamp:HH:mm:ss.fffffff} in {x.duration}"))}"); + Console.WriteLine($"\t{string.Join(", ", operation.Value.Select(x => $"Timestamps: {x.timestamp:HH:mm:ss.fffffff}, Duration: {x.duration}, Cancelled: {x.isCancelled}"))}"); } Console.ForegroundColor = ConsoleColor.Cyan; @@ -466,7 +466,7 @@ namespace HttpStress private class StructuralEqualityComparer : IEqualityComparer where T : IStructuralEquatable { - public bool Equals([AllowNull] T left, [AllowNull] T right) => left != null && left.Equals(right, StructuralComparisons.StructuralEqualityComparer); + public bool Equals(T? left, T? right) => left != null && left.Equals(right, StructuralComparisons.StructuralEqualityComparer); public int GetHashCode([DisallowNull] T value) => value.GetHashCode(StructuralComparisons.StructuralEqualityComparer); } } diff --git a/src/libraries/System.Net.Security/tests/StressTests/SslStress/Utils/ErrorAggregator.cs b/src/libraries/System.Net.Security/tests/StressTests/SslStress/Utils/ErrorAggregator.cs index 04db9dd..9133bc3 100644 --- a/src/libraries/System.Net.Security/tests/StressTests/SslStress/Utils/ErrorAggregator.cs +++ b/src/libraries/System.Net.Security/tests/StressTests/SslStress/Utils/ErrorAggregator.cs @@ -113,7 +113,7 @@ namespace SslStress.Utils private class StructuralEqualityComparer : IEqualityComparer where T : IStructuralEquatable { - public bool Equals([AllowNull] T left, [AllowNull] T right) => left != null && left.Equals(right, StructuralComparisons.StructuralEqualityComparer); + public bool Equals(T? left, T? right) => left != null && left.Equals(right, StructuralComparisons.StructuralEqualityComparer); public int GetHashCode([DisallowNull] T value) => value.GetHashCode(StructuralComparisons.StructuralEqualityComparer); } } -- 2.7.4