From 39add8f79604e3665114ec1ef5c09c7def58e54b Mon Sep 17 00:00:00 2001 From: Timothy Mothra Date: Thu, 20 May 2021 17:09:31 -0700 Subject: [PATCH] add Net5.0 to Test Infra and Bask SDK Tests (#2272) --- BASE/.vsts/linux-build.yml | 26 +++++++------------ .../Channel/TransmissionTest.cs | 5 ++++ .../DataContracts/RequestTelemetryTest.cs | 2 +- .../TelemetryConfigurationFactoryTest.cs | 2 +- ...Microsoft.ApplicationInsights.Tests.csproj | 2 +- 5 files changed, 18 insertions(+), 19 deletions(-) diff --git a/BASE/.vsts/linux-build.yml b/BASE/.vsts/linux-build.yml index 40360a2ed8..f60dd3e7ac 100644 --- a/BASE/.vsts/linux-build.yml +++ b/BASE/.vsts/linux-build.yml @@ -3,10 +3,12 @@ pool: strategy: matrix: - netcoreapp2_1: - framework: netcoreapp2.1 + #netcoreapp2_1: + # framework: netcoreapp2.1 netcoreapp3_1: framework: netcoreapp3.1 + net5_0: + framework: net5.0 maxParallel: 2 steps: @@ -20,6 +22,11 @@ steps: displayName: install dotnet core 3.1 inputs: version: 3.1.x + +- task: UseDotNet@2 + displayName: install dotnet 5.0 + inputs: + version: '5.0.x' - task: DotNetCoreCLI@2 displayName: DotNetCoreCLI - Restore Solution @@ -38,7 +45,7 @@ steps: displayName: DotNetCoreCLI - Test $(framework) inputs: command: "test" - projects: "BASE/Test/**/Microsoft.ApplicationInsights.Tests.csproj" + projects: "BASE/Test/**/*.Tests.csproj" arguments: "--configuration Release --framework $(framework) --no-build -l trx --filter TestCategory!=WindowsOnly" ## Publish Test results @@ -49,16 +56,3 @@ steps: testRunner: "VSTest" testResultsFiles: "**/*.trx" failTaskOnFailedTests: true - -#- task: DotNetCoreCLI@2 -# inputs: -# command: "publish" -# publishWebProjects: "True" -# arguments: "--configuration Release --output $(build.artifactstagingdirectory)" -# zipAfterPublish: "True" - -#- task: PublishBuildArtifacts@1 -# inputs: -# PathtoPublish: "$(build.artifactstagingdirectory)" -# ArtifactName: "drop" -# ArtifactType: "Container" diff --git a/BASE/Test/Microsoft.ApplicationInsights.Test/Microsoft.ApplicationInsights.Tests/Channel/TransmissionTest.cs b/BASE/Test/Microsoft.ApplicationInsights.Test/Microsoft.ApplicationInsights.Tests/Channel/TransmissionTest.cs index e62cb72d9c..c77a15a1b2 100644 --- a/BASE/Test/Microsoft.ApplicationInsights.Test/Microsoft.ApplicationInsights.Tests/Channel/TransmissionTest.cs +++ b/BASE/Test/Microsoft.ApplicationInsights.Test/Microsoft.ApplicationInsights.Tests/Channel/TransmissionTest.cs @@ -220,7 +220,12 @@ public async Task SendAsyncHandleResponseForPartialContentResponse() // VALIDATE Assert.AreEqual(206, result.StatusCode); Assert.AreEqual("5", result.RetryAfterHeader); + +#if NET5_0 + Assert.IsTrue(result.Content == string.Empty); +#else Assert.IsNull(result.Content); +#endif } } diff --git a/BASE/Test/Microsoft.ApplicationInsights.Test/Microsoft.ApplicationInsights.Tests/DataContracts/RequestTelemetryTest.cs b/BASE/Test/Microsoft.ApplicationInsights.Test/Microsoft.ApplicationInsights.Tests/DataContracts/RequestTelemetryTest.cs index af15c7e30b..5389b27a06 100644 --- a/BASE/Test/Microsoft.ApplicationInsights.Test/Microsoft.ApplicationInsights.Tests/DataContracts/RequestTelemetryTest.cs +++ b/BASE/Test/Microsoft.ApplicationInsights.Test/Microsoft.ApplicationInsights.Tests/DataContracts/RequestTelemetryTest.cs @@ -34,7 +34,7 @@ public void ParameterlessConstructorInitializesRequiredFields() Assert.IsFalse(request.Source == null); Assert.IsFalse(request.Name == null); Assert.IsFalse(request.ResponseCode == null); - Assert.IsFalse(request.Duration == null); + Assert.IsTrue(request.Duration == default); Assert.IsTrue(request.Success == null); Assert.IsTrue(request.Data.success); Assert.AreEqual(SamplingDecision.None, request.ProactiveSamplingDecision); diff --git a/BASE/Test/Microsoft.ApplicationInsights.Test/Microsoft.ApplicationInsights.Tests/Extensibility/TelemetryConfigurationFactoryTest.cs b/BASE/Test/Microsoft.ApplicationInsights.Test/Microsoft.ApplicationInsights.Tests/Extensibility/TelemetryConfigurationFactoryTest.cs index 87f084e723..6ce0f6e1ed 100644 --- a/BASE/Test/Microsoft.ApplicationInsights.Test/Microsoft.ApplicationInsights.Tests/Extensibility/TelemetryConfigurationFactoryTest.cs +++ b/BASE/Test/Microsoft.ApplicationInsights.Test/Microsoft.ApplicationInsights.Tests/Extensibility/TelemetryConfigurationFactoryTest.cs @@ -504,7 +504,7 @@ public void LoadInstanceSetsInstancePropertiesOfTimeSpanTypeFromChildElementValu } [TestMethod] -#if NETCOREAPP3_1 +#if NETCOREAPP3_1 || NET5_0 [ExpectedExceptionWithMessage(typeof(ArgumentException), "Failed to parse configuration value. Property: 'TimeSpanProperty' Reason: String 'TestValue' was not recognized as a valid TimeSpan.")] #else [ExpectedExceptionWithMessage(typeof(ArgumentException), "Failed to parse configuration value. Property: 'TimeSpanProperty' Reason: String was not recognized as a valid TimeSpan.")] diff --git a/BASE/Test/Microsoft.ApplicationInsights.Test/Microsoft.ApplicationInsights.Tests/Microsoft.ApplicationInsights.Tests.csproj b/BASE/Test/Microsoft.ApplicationInsights.Test/Microsoft.ApplicationInsights.Tests/Microsoft.ApplicationInsights.Tests.csproj index ba15b0357e..5e3625fe58 100644 --- a/BASE/Test/Microsoft.ApplicationInsights.Test/Microsoft.ApplicationInsights.Tests/Microsoft.ApplicationInsights.Tests.csproj +++ b/BASE/Test/Microsoft.ApplicationInsights.Test/Microsoft.ApplicationInsights.Tests/Microsoft.ApplicationInsights.Tests.csproj @@ -2,7 +2,7 @@ - net452;net46;netcoreapp2.1;netcoreapp3.1 + net452;net46;netcoreapp2.1;netcoreapp3.1;net5.0 netcoreapp2.1;netcoreapp3.1 true