Update samples and tests to target netcoreapp2.1

This commit is contained in:
Pranav K 2017-11-13 14:36:26 -08:00
parent c998d74e1d
commit 8fece7e7bb
13 changed files with 82 additions and 60 deletions

View File

@ -1,4 +1,8 @@
<Project> <Project>
<Import
Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), AspNetCoreSettings.props))\AspNetCoreSettings.props"
Condition=" '$(CI)' != 'true' AND '$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), AspNetCoreSettings.props))' != '' " />
<Import Project="version.props" /> <Import Project="version.props" />
<Import Project="build\dependencies.props" /> <Import Project="build\dependencies.props" />

View File

@ -5,29 +5,29 @@
<PropertyGroup Label="Package Versions"> <PropertyGroup Label="Package Versions">
<InternalAspNetCoreSdkPackageVersion>2.1.0-preview1-15549</InternalAspNetCoreSdkPackageVersion> <InternalAspNetCoreSdkPackageVersion>2.1.0-preview1-15549</InternalAspNetCoreSdkPackageVersion>
<MicrosoftApplicationInsightsAspNetCorePackageVersion>2.1.1</MicrosoftApplicationInsightsAspNetCorePackageVersion> <MicrosoftApplicationInsightsAspNetCorePackageVersion>2.1.1</MicrosoftApplicationInsightsAspNetCorePackageVersion>
<MicrosoftAspNetCoreDataProtectionAzureKeyVaultPackageVersion>2.1.0-preview1-27488</MicrosoftAspNetCoreDataProtectionAzureKeyVaultPackageVersion> <MicrosoftAspNetCoreDataProtectionAzureKeyVaultPackageVersion>2.1.0-preview1-27579</MicrosoftAspNetCoreDataProtectionAzureKeyVaultPackageVersion>
<MicrosoftAspNetCoreHostingAbstractionsPackageVersion>2.1.0-preview1-27488</MicrosoftAspNetCoreHostingAbstractionsPackageVersion> <MicrosoftAspNetCoreHostingAbstractionsPackageVersion>2.1.0-preview1-27579</MicrosoftAspNetCoreHostingAbstractionsPackageVersion>
<MicrosoftAspNetCoreHostingPackageVersion>2.1.0-preview1-27488</MicrosoftAspNetCoreHostingPackageVersion> <MicrosoftAspNetCoreHostingPackageVersion>2.1.0-preview1-27579</MicrosoftAspNetCoreHostingPackageVersion>
<MicrosoftAspNetCoreIdentityServiceAzureKeyVaultPackageVersion>2.1.0-preview1-27488</MicrosoftAspNetCoreIdentityServiceAzureKeyVaultPackageVersion> <MicrosoftAspNetCoreIdentityServiceAzureKeyVaultPackageVersion>2.1.0-preview1-27579</MicrosoftAspNetCoreIdentityServiceAzureKeyVaultPackageVersion>
<MicrosoftAspNetCoreMvcPackageVersion>2.1.0-preview1-27488</MicrosoftAspNetCoreMvcPackageVersion> <MicrosoftAspNetCoreMvcPackageVersion>2.1.0-preview1-27579</MicrosoftAspNetCoreMvcPackageVersion>
<MicrosoftAspNetCoreRazorRuntimePackageVersion>2.1.0-preview1-27488</MicrosoftAspNetCoreRazorRuntimePackageVersion> <MicrosoftAspNetCoreRazorRuntimePackageVersion>2.1.0-preview1-27579</MicrosoftAspNetCoreRazorRuntimePackageVersion>
<MicrosoftAspNetCoreServerIISIntegrationPackageVersion>2.1.0-preview1-27488</MicrosoftAspNetCoreServerIISIntegrationPackageVersion> <MicrosoftAspNetCoreServerIISIntegrationPackageVersion>2.1.0-preview1-27579</MicrosoftAspNetCoreServerIISIntegrationPackageVersion>
<MicrosoftAspNetCoreServerIntegrationTestingPackageVersion>0.5.0-preview1-27488</MicrosoftAspNetCoreServerIntegrationTestingPackageVersion> <MicrosoftAspNetCoreServerIntegrationTestingPackageVersion>0.5.0-preview1-27579</MicrosoftAspNetCoreServerIntegrationTestingPackageVersion>
<MicrosoftAspNetCoreServerKestrelPackageVersion>2.1.0-preview1-27488</MicrosoftAspNetCoreServerKestrelPackageVersion> <MicrosoftAspNetCoreServerKestrelPackageVersion>2.1.0-preview1-27579</MicrosoftAspNetCoreServerKestrelPackageVersion>
<MicrosoftAspNetCoreTestHostPackageVersion>2.1.0-preview1-27488</MicrosoftAspNetCoreTestHostPackageVersion> <MicrosoftAspNetCoreTestHostPackageVersion>2.1.0-preview1-27579</MicrosoftAspNetCoreTestHostPackageVersion>
<MicrosoftAzureManagementFluentPackageVersion>1.1.3</MicrosoftAzureManagementFluentPackageVersion> <MicrosoftAzureManagementFluentPackageVersion>1.1.3</MicrosoftAzureManagementFluentPackageVersion>
<MicrosoftAzureServicesAppAuthenticationPackageVersion>1.0.0-preview</MicrosoftAzureServicesAppAuthenticationPackageVersion> <MicrosoftAzureServicesAppAuthenticationPackageVersion>1.0.0-preview</MicrosoftAzureServicesAppAuthenticationPackageVersion>
<MicrosoftExtensionsConfigurationAzureKeyVaultPackageVersion>2.1.0-preview1-27488</MicrosoftExtensionsConfigurationAzureKeyVaultPackageVersion> <MicrosoftExtensionsConfigurationAzureKeyVaultPackageVersion>2.1.0-preview1-27579</MicrosoftExtensionsConfigurationAzureKeyVaultPackageVersion>
<MicrosoftExtensionsConfigurationCommandLinePackageVersion>2.1.0-preview1-27488</MicrosoftExtensionsConfigurationCommandLinePackageVersion> <MicrosoftExtensionsConfigurationCommandLinePackageVersion>2.1.0-preview1-27579</MicrosoftExtensionsConfigurationCommandLinePackageVersion>
<MicrosoftExtensionsConfigurationEnvironmentVariablesPackageVersion>2.1.0-preview1-27488</MicrosoftExtensionsConfigurationEnvironmentVariablesPackageVersion> <MicrosoftExtensionsConfigurationEnvironmentVariablesPackageVersion>2.1.0-preview1-27579</MicrosoftExtensionsConfigurationEnvironmentVariablesPackageVersion>
<MicrosoftExtensionsConfigurationJsonPackageVersion>2.1.0-preview1-27488</MicrosoftExtensionsConfigurationJsonPackageVersion> <MicrosoftExtensionsConfigurationJsonPackageVersion>2.1.0-preview1-27579</MicrosoftExtensionsConfigurationJsonPackageVersion>
<MicrosoftExtensionsDiagnosticAdapterPackageVersion>2.1.0-preview1-27488</MicrosoftExtensionsDiagnosticAdapterPackageVersion> <MicrosoftExtensionsDiagnosticAdapterPackageVersion>2.1.0-preview1-27579</MicrosoftExtensionsDiagnosticAdapterPackageVersion>
<MicrosoftExtensionsLoggingAzureAppServicesPackageVersion>2.1.0-preview1-27488</MicrosoftExtensionsLoggingAzureAppServicesPackageVersion> <MicrosoftExtensionsLoggingAzureAppServicesPackageVersion>2.1.0-preview1-27579</MicrosoftExtensionsLoggingAzureAppServicesPackageVersion>
<MicrosoftExtensionsLoggingConfigurationPackageVersion>2.1.0-preview1-27488</MicrosoftExtensionsLoggingConfigurationPackageVersion> <MicrosoftExtensionsLoggingConfigurationPackageVersion>2.1.0-preview1-27579</MicrosoftExtensionsLoggingConfigurationPackageVersion>
<MicrosoftExtensionsLoggingConsolePackageVersion>2.1.0-preview1-27488</MicrosoftExtensionsLoggingConsolePackageVersion> <MicrosoftExtensionsLoggingConsolePackageVersion>2.1.0-preview1-27579</MicrosoftExtensionsLoggingConsolePackageVersion>
<MicrosoftExtensionsLoggingPackageVersion>2.1.0-preview1-27488</MicrosoftExtensionsLoggingPackageVersion> <MicrosoftExtensionsLoggingPackageVersion>2.1.0-preview1-27579</MicrosoftExtensionsLoggingPackageVersion>
<MicrosoftExtensionsLoggingTestingPackageVersion>2.1.0-preview1-27488</MicrosoftExtensionsLoggingTestingPackageVersion> <MicrosoftExtensionsLoggingTestingPackageVersion>2.1.0-preview1-27579</MicrosoftExtensionsLoggingTestingPackageVersion>
<MicrosoftExtensionsProcessSourcesPackageVersion>2.1.0-preview1-27488</MicrosoftExtensionsProcessSourcesPackageVersion> <MicrosoftExtensionsProcessSourcesPackageVersion>2.1.0-preview1-27579</MicrosoftExtensionsProcessSourcesPackageVersion>
<MicrosoftNETCoreApp20PackageVersion>2.0.0</MicrosoftNETCoreApp20PackageVersion> <MicrosoftNETCoreApp20PackageVersion>2.0.0</MicrosoftNETCoreApp20PackageVersion>
<MicrosoftNETTestSdkPackageVersion>15.3.0</MicrosoftNETTestSdkPackageVersion> <MicrosoftNETTestSdkPackageVersion>15.3.0</MicrosoftNETTestSdkPackageVersion>
<MicrosoftWebXdtPackageVersion>1.4.0</MicrosoftWebXdtPackageVersion> <MicrosoftWebXdtPackageVersion>1.4.0</MicrosoftWebXdtPackageVersion>

View File

@ -1,2 +1,2 @@
version:2.1.0-preview1-15549 version:2.1.0-preview1-15567
commithash:f570e08585fec510dd60cd4bfe8795388b757a95 commithash:903e3104807b1bb8cddd28bdef205b1e2dc021d1

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web"> <Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>netcoreapp2.0;net461</TargetFrameworks> <TargetFrameworks>netcoreapp2.1;netcoreapp2.0;net461</TargetFrameworks>
<RuntimeIdentifiers>win7-x86;win7-x64;linux-x64;osx-x64</RuntimeIdentifiers> <RuntimeIdentifiers>win7-x86;win7-x64;linux-x64;osx-x64</RuntimeIdentifiers>
</PropertyGroup> </PropertyGroup>

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web"> <Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>netcoreapp2.0;net461</TargetFrameworks> <TargetFrameworks>netcoreapp2.1;net461</TargetFrameworks>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web"> <Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>netcoreapp2.0;net461</TargetFrameworks> <TargetFrameworks>netcoreapp2.1;net461</TargetFrameworks>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@ -4,7 +4,7 @@
<PropertyGroup> <PropertyGroup>
<Description>ASP.NET Core lightup integration with Application Insights.</Description> <Description>ASP.NET Core lightup integration with Application Insights.</Description>
<TargetFrameworks>netcoreapp2.0;net461</TargetFrameworks> <TargetFrameworks>netcoreapp2.1;netcoreapp2.0;net461</TargetFrameworks>
<GenerateDocumentationFile>true</GenerateDocumentationFile> <GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageTags>aspnetcore;ApplicationInsights;Analytics;Telemetry;AppInsights</PackageTags> <PackageTags>aspnetcore;ApplicationInsights;Analytics;Telemetry;AppInsights</PackageTags>
</PropertyGroup> </PropertyGroup>

View File

@ -4,7 +4,7 @@
<PropertyGroup> <PropertyGroup>
<Description>ASP.NET Core lightup integration with Azure AppServices.</Description> <Description>ASP.NET Core lightup integration with Azure AppServices.</Description>
<TargetFrameworks>netcoreapp2.0;net461</TargetFrameworks> <TargetFrameworks>netcoreapp2.1;netcoreapp2.0;net461</TargetFrameworks>
<GenerateDocumentationFile>true</GenerateDocumentationFile> <GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageTags>aspnetcore;azure;appservices</PackageTags> <PackageTags>aspnetcore;azure;appservices</PackageTags>
</PropertyGroup> </PropertyGroup>

View File

@ -1,8 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>netcoreapp2.0;net461</TargetFrameworks> <TargetFramework>netcoreapp2.1</TargetFramework>
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp2.0</TargetFrameworks>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@ -17,15 +17,19 @@ namespace ApplicationInsightsJavaScriptSnippetTest
{ {
} }
[Theory] [Fact]
[InlineData(ApplicationType.Portable)] public Task ScriptIsInjected_ForNetCoreApp20_Standalone() => JavaScriptSnippetInjectionTestSuite("netcoreapp2.0", ApplicationType.Standalone);
[InlineData(ApplicationType.Standalone)]
public async Task ScriptInjected(ApplicationType applicationType)
{
await JavaScriptSnippetInjectionTestSuite(applicationType);
}
private async Task JavaScriptSnippetInjectionTestSuite(ApplicationType applicationType) [Fact]
public Task ScriptIsInjected_ForNetCoreApp20_Portable() => JavaScriptSnippetInjectionTestSuite("netcoreapp2.0", ApplicationType.Portable);
[Fact]
public Task ScriptIsInjected_ForNetCoreApp21_Standalone() => JavaScriptSnippetInjectionTestSuite("netcoreapp2.1", ApplicationType.Standalone);
[Fact]
public Task ScriptIsInjected_ForNetCoreApp21_Portable() => JavaScriptSnippetInjectionTestSuite("netcoreapp2.1", ApplicationType.Portable);
private async Task JavaScriptSnippetInjectionTestSuite(string targetFramework, ApplicationType applicationType)
{ {
var testName = $"ApplicationInsightsJavaScriptSnippetTest_{applicationType}"; var testName = $"ApplicationInsightsJavaScriptSnippetTest_{applicationType}";
using (StartLog(out var loggerFactory, testName)) using (StartLog(out var loggerFactory, testName))
@ -35,7 +39,7 @@ namespace ApplicationInsightsJavaScriptSnippetTest
{ {
PublishApplicationBeforeDeployment = true, PublishApplicationBeforeDeployment = true,
PreservePublishedApplicationForDebugging = PreservePublishedApplicationForDebugging, PreservePublishedApplicationForDebugging = PreservePublishedApplicationForDebugging,
TargetFramework = "netcoreapp2.0", TargetFramework = targetFramework,
Configuration = GetCurrentBuildConfiguration(), Configuration = GetCurrentBuildConfiguration(),
ApplicationType = applicationType, ApplicationType = applicationType,
EnvironmentName = "JavaScript", EnvironmentName = "JavaScript",

View File

@ -17,26 +17,22 @@ namespace ApplicationInsightsJavaScriptSnippetTest
{ {
} }
[Theory] [Fact]
[InlineData(ApplicationType.Portable)] public Task DefaultAILogFiltersApplied_ForNetCoreApp20_Portable() => DefaultAILogFiltersApplied("netcoreapp2.0", ApplicationType.Portable);
[InlineData(ApplicationType.Standalone)]
public async Task DefaultAILogFiltersApplied(ApplicationType applicationType)
{
var responseText = await RunRequest(applicationType, "DefaultLogging");
AssertDefaultLogs(responseText);
}
[Theory] [Fact]
[InlineData(ApplicationType.Portable)] public Task DefaultAILogFiltersApplied_ForNetCoreApp20_Standalone() => DefaultAILogFiltersApplied("netcoreapp2.0", ApplicationType.Standalone);
[InlineData(ApplicationType.Standalone)]
public async Task CustomAILogFiltersApplied(ApplicationType applicationType)
{
var responseText = await RunRequest(applicationType, "CustomLogging");
AssertCustomLogs(responseText);
}
private static void AssertDefaultLogs(string responseText) [Fact]
public Task DefaultAILogFiltersApplied_ForNetCoreApp21_Portable() => DefaultAILogFiltersApplied("netcoreapp2.1", ApplicationType.Portable);
[Fact]
public Task DefaultAILogFiltersApplied_ForNetCoreApp21_Standalone() => DefaultAILogFiltersApplied("netcoreapp2.1", ApplicationType.Standalone);
private async Task DefaultAILogFiltersApplied(string targetFramework, ApplicationType applicationType)
{ {
var responseText = await RunRequest(targetFramework, applicationType, "DefaultLogging");
// Enabled by default // Enabled by default
Assert.Contains("System warning log", responseText); Assert.Contains("System warning log", responseText);
// Disabled by default // Disabled by default
@ -66,8 +62,21 @@ namespace ApplicationInsightsJavaScriptSnippetTest
Assert.Contains("Specific trace log", responseText); Assert.Contains("Specific trace log", responseText);
} }
private static void AssertCustomLogs(string responseText) [Fact]
public Task CustomAILogFiltersApplied_ForNetCoreApp20_Portable() => CustomAILogFiltersApplied("netcoreapp2.0", ApplicationType.Portable);
[Fact]
public Task CustomAILogFiltersApplied_ForNetCoreApp20_Standalone() => CustomAILogFiltersApplied("netcoreapp2.0", ApplicationType.Standalone);
[Fact]
public Task CustomAILogFiltersApplied_ForNetCoreApp21_Portable() => CustomAILogFiltersApplied("netcoreapp2.1", ApplicationType.Portable);
[Fact]
public Task CustomAILogFiltersApplied_ForNetCoreApp21_Standalone() => CustomAILogFiltersApplied("netcoreapp2.1", ApplicationType.Standalone);
private async Task CustomAILogFiltersApplied(string targetFramework, ApplicationType applicationType)
{ {
var responseText = await RunRequest(targetFramework, applicationType, "CustomLogging");
// Custom logger allows only namespaces with 'o' in the name // Custom logger allows only namespaces with 'o' in the name
Assert.DoesNotContain("System warning log", responseText); Assert.DoesNotContain("System warning log", responseText);
@ -90,7 +99,7 @@ namespace ApplicationInsightsJavaScriptSnippetTest
Assert.DoesNotContain("Specific trace log", responseText); Assert.DoesNotContain("Specific trace log", responseText);
} }
private async Task<string> RunRequest(ApplicationType applicationType, string environment) private async Task<string> RunRequest(string targetFramework, ApplicationType applicationType, string environment)
{ {
string responseText; string responseText;
var testName = $"ApplicationInsightsLoggingTest_{applicationType}"; var testName = $"ApplicationInsightsLoggingTest_{applicationType}";

View File

@ -1,6 +1,13 @@
<Project> <Project>
<Import Project="..\Directory.Build.props" /> <Import Project="..\Directory.Build.props" />
<PropertyGroup>
<DeveloperBuildTestTfms>netcoreapp2.1</DeveloperBuildTestTfms>
<StandardTestTfms>$(DeveloperBuildTestTfms)</StandardTestTfms>
<StandardTestTfms Condition=" '$(DeveloperBuild)' != 'true' ">netcoreapp2.1;netcoreapp2.0</StandardTestTfms>
<StandardTestTfms Condition=" '$(DeveloperBuild)' != 'true' AND '$(OS)' == 'Windows_NT' ">$(StandardTestTfms);net461</StandardTestTfms>
</PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Internal.AspNetCore.Sdk" PrivateAssets="All" Version="$(InternalAspNetCoreSdkPackageVersion)" /> <PackageReference Include="Internal.AspNetCore.Sdk" PrivateAssets="All" Version="$(InternalAspNetCoreSdkPackageVersion)" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(MicrosoftNETTestSdkPackageVersion)" /> <PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(MicrosoftNETTestSdkPackageVersion)" />

View File

@ -1,8 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>netcoreapp2.0;net461</TargetFrameworks> <TargetFrameworks>$(StandardTestTfms)</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp2.0</TargetFrameworks>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>