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>
<Import
Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), AspNetCoreSettings.props))\AspNetCoreSettings.props"
Condition=" '$(CI)' != 'true' AND '$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), AspNetCoreSettings.props))' != '' " />
<Import Project="version.props" />
<Import Project="build\dependencies.props" />

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -4,7 +4,7 @@
<PropertyGroup>
<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>
<PackageTags>aspnetcore;ApplicationInsights;Analytics;Telemetry;AppInsights</PackageTags>
</PropertyGroup>

View File

@ -4,7 +4,7 @@
<PropertyGroup>
<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>
<PackageTags>aspnetcore;azure;appservices</PackageTags>
</PropertyGroup>

View File

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

View File

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

View File

@ -17,26 +17,22 @@ namespace ApplicationInsightsJavaScriptSnippetTest
{
}
[Theory]
[InlineData(ApplicationType.Portable)]
[InlineData(ApplicationType.Standalone)]
public async Task DefaultAILogFiltersApplied(ApplicationType applicationType)
{
var responseText = await RunRequest(applicationType, "DefaultLogging");
AssertDefaultLogs(responseText);
}
[Fact]
public Task DefaultAILogFiltersApplied_ForNetCoreApp20_Portable() => DefaultAILogFiltersApplied("netcoreapp2.0", ApplicationType.Portable);
[Theory]
[InlineData(ApplicationType.Portable)]
[InlineData(ApplicationType.Standalone)]
public async Task CustomAILogFiltersApplied(ApplicationType applicationType)
{
var responseText = await RunRequest(applicationType, "CustomLogging");
AssertCustomLogs(responseText);
}
[Fact]
public Task DefaultAILogFiltersApplied_ForNetCoreApp20_Standalone() => DefaultAILogFiltersApplied("netcoreapp2.0", ApplicationType.Standalone);
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
Assert.Contains("System warning log", responseText);
// Disabled by default
@ -66,8 +62,21 @@ namespace ApplicationInsightsJavaScriptSnippetTest
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
Assert.DoesNotContain("System warning log", responseText);
@ -90,7 +99,7 @@ namespace ApplicationInsightsJavaScriptSnippetTest
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;
var testName = $"ApplicationInsightsLoggingTest_{applicationType}";

View File

@ -1,6 +1,13 @@
<Project>
<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>
<PackageReference Include="Internal.AspNetCore.Sdk" PrivateAssets="All" Version="$(InternalAspNetCoreSdkPackageVersion)" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(MicrosoftNETTestSdkPackageVersion)" />

View File

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