Reenable some helix tests (#7763)

* Fix identity UI script tests on helix
* Add OnHelix static helper method
This commit is contained in:
Hao Kung 2019-02-25 23:39:46 -08:00 committed by GitHub
parent 40b2a945b3
commit a2c8a34556
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 48 additions and 18 deletions

View File

@ -38,8 +38,7 @@ namespace Microsoft.AspNetCore.Identity.Test
} }
} }
[ConditionalTheory] [Theory]
[SkipOnHelix] // https://github.com/aspnet/AspNetCore/issues/6549
[MemberData(nameof(ScriptWithIntegrityData))] [MemberData(nameof(ScriptWithIntegrityData))]
public async Task IdentityUI_ScriptTags_SubresourceIntegrityCheck(ScriptTag scriptTag) public async Task IdentityUI_ScriptTags_SubresourceIntegrityCheck(ScriptTag scriptTag)
{ {
@ -68,8 +67,7 @@ namespace Microsoft.AspNetCore.Identity.Test
} }
} }
[ConditionalTheory] [Theory]
[SkipOnHelix] // https://github.com/aspnet/AspNetCore/issues/6549
[MemberData(nameof(ScriptWithFallbackSrcData))] [MemberData(nameof(ScriptWithFallbackSrcData))]
public async Task IdentityUI_ScriptTags_FallbackSourceContent_Matches_CDNContent(ScriptTag scriptTag) public async Task IdentityUI_ScriptTags_FallbackSourceContent_Matches_CDNContent(ScriptTag scriptTag)
{ {
@ -148,13 +146,17 @@ namespace Microsoft.AspNetCore.Identity.Test
private static string GetSolutionDir() private static string GetSolutionDir()
{ {
var dir = new DirectoryInfo(AppContext.BaseDirectory); var dir = new DirectoryInfo(AppContext.BaseDirectory);
while (dir != null) // On helix we use the published copy
if (!SkipOnHelixAttribute.OnHelix())
{ {
if (File.Exists(Path.Combine(dir.FullName, "Identity.sln"))) while (dir != null)
{ {
break; if (File.Exists(Path.Combine(dir.FullName, "Identity.sln")))
{
break;
}
dir = dir.Parent;
} }
dir = dir.Parent;
} }
return dir.FullName; return dir.FullName;
} }

View File

@ -7,6 +7,8 @@
<ItemGroup> <ItemGroup>
<Compile Include="$(IdentityTestSharedSourceRoot)**\*.cs" /> <Compile Include="$(IdentityTestSharedSourceRoot)**\*.cs" />
<Compile Include="$(SharedSourceRoot)test\SkipOnHelixAttribute.cs" /> <Compile Include="$(SharedSourceRoot)test\SkipOnHelixAttribute.cs" />
<HelixContent Include="..\..\UI\src\Areas\Identity\Pages\**\*.*" LinkBase="UI\src\Areas\Identity\Pages" />
<HelixContent Include="..\..\UI\src\wwwroot\**\*.*" LinkBase="UI\src\wwwroot" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -1,9 +1,11 @@
// Copyright (c) .NET Foundation. All rights reserved. // Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.IO; using System.IO;
using Microsoft.AspNetCore.Analyzer.Testing; using Microsoft.AspNetCore.Analyzer.Testing;
using Microsoft.AspNetCore.Testing; using Microsoft.AspNetCore.Testing;
using Microsoft.AspNetCore.Testing.xunit;
namespace Microsoft.AspNetCore.Mvc namespace Microsoft.AspNetCore.Mvc
{ {
@ -25,6 +27,12 @@ namespace Microsoft.AspNetCore.Mvc
private static string GetProjectDirectory() private static string GetProjectDirectory()
{ {
// On helix we use the published test files
if (SkipOnHelixAttribute.OnHelix())
{
return AppContext.BaseDirectory;
}
var solutionDirectory = TestPathUtilities.GetSolutionRootDirectory("Mvc"); var solutionDirectory = TestPathUtilities.GetSolutionRootDirectory("Mvc");
var projectDirectory = Path.Combine(solutionDirectory, "Mvc.Analyzers", "test"); var projectDirectory = Path.Combine(solutionDirectory, "Mvc.Analyzers", "test");
return projectDirectory; return projectDirectory;

View File

@ -4,12 +4,14 @@
<TargetFramework>netcoreapp3.0</TargetFramework> <TargetFramework>netcoreapp3.0</TargetFramework>
<PreserveCompilationContext>true</PreserveCompilationContext> <PreserveCompilationContext>true</PreserveCompilationContext>
<RootNamespace>Microsoft.AspNetCore.Mvc.Analyzers</RootNamespace> <RootNamespace>Microsoft.AspNetCore.Mvc.Analyzers</RootNamespace>
<!-- https://github.com/aspnet/AspNetCore/issues/6549 --> <!-- https://github.com/aspnet/AspNetCore/issues/6549 -->
<BuildHelixPayload>false</BuildHelixPayload> <BuildHelixPayload>false</BuildHelixPayload>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<None Include="xunit.runner.json" CopyToOutputDirectory="PreserveNewest" /> <None Include="xunit.runner.json" CopyToOutputDirectory="PreserveNewest" />
<Compile Include="$(SharedSourceRoot)test\SkipOnHelixAttribute.cs" />
<Content Include="TestFiles\**\*.*" CopyToPublishDirectory="PreserveNewest" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -1,9 +1,11 @@
// Copyright (c) .NET Foundation. All rights reserved. // Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.IO; using System.IO;
using Microsoft.AspNetCore.Analyzer.Testing; using Microsoft.AspNetCore.Analyzer.Testing;
using Microsoft.AspNetCore.Testing; using Microsoft.AspNetCore.Testing;
using Microsoft.AspNetCore.Testing.xunit;
namespace Microsoft.AspNetCore.Mvc namespace Microsoft.AspNetCore.Mvc
{ {
@ -25,6 +27,12 @@ namespace Microsoft.AspNetCore.Mvc
private static string GetProjectDirectory() private static string GetProjectDirectory()
{ {
// On helix we use the published test files
if (SkipOnHelixAttribute.OnHelix())
{
return AppContext.BaseDirectory;
}
var solutionDirectory = TestPathUtilities.GetSolutionRootDirectory("Mvc"); var solutionDirectory = TestPathUtilities.GetSolutionRootDirectory("Mvc");
var projectDirectory = Path.Combine(solutionDirectory, "Mvc.Api.Analyzers", "test"); var projectDirectory = Path.Combine(solutionDirectory, "Mvc.Api.Analyzers", "test");
return projectDirectory; return projectDirectory;

View File

@ -3,12 +3,14 @@
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework> <TargetFramework>netcoreapp3.0</TargetFramework>
<RootNamespace>Microsoft.AspNetCore.Mvc.Api.Analyzers</RootNamespace> <RootNamespace>Microsoft.AspNetCore.Mvc.Api.Analyzers</RootNamespace>
<!-- https://github.com/aspnet/AspNetCore/issues/6549 --> <!-- https://github.com/aspnet/AspNetCore/issues/6549 -->
<BuildHelixPayload>false</BuildHelixPayload> <BuildHelixPayload>false</BuildHelixPayload>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Compile Include="..\..\Mvc.Analyzers\test\Infrastructure\MvcDiagnosticAnalyzerRunner.cs" Link="Infrastructure\MvcDiagnosticAnalyzerRunner.cs" /> <Compile Include="..\..\Mvc.Analyzers\test\Infrastructure\MvcDiagnosticAnalyzerRunner.cs" Link="Infrastructure\MvcDiagnosticAnalyzerRunner.cs" />
<Compile Include="$(SharedSourceRoot)test\SkipOnHelixAttribute.cs" />
<Content Include="TestFiles\**\*.*" CopyToPublishDirectory="PreserveNewest" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -16,6 +16,7 @@ using Microsoft.AspNetCore.Http.Features;
using Microsoft.AspNetCore.Server.Kestrel.Core.Features; using Microsoft.AspNetCore.Server.Kestrel.Core.Features;
using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2; using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2;
using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2.HPack; using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2.HPack;
using Microsoft.AspNetCore.Testing.xunit;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Microsoft.Net.Http.Headers; using Microsoft.Net.Http.Headers;
using Xunit; using Xunit;
@ -1015,7 +1016,8 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests
Assert.IsType<Http2StreamErrorException>(thrownEx.InnerException); Assert.IsType<Http2StreamErrorException>(thrownEx.InnerException);
} }
[Fact] [ConditionalFact]
[SkipOnHelix] // https://github.com/aspnet/AspNetCore/issues/7000
public async Task ContentLength_Received_ReadViaPipes() public async Task ContentLength_Received_ReadViaPipes()
{ {
await InitializeConnectionAsync(async context => await InitializeConnectionAsync(async context =>

View File

@ -11,6 +11,7 @@ using Microsoft.AspNetCore.Server.Kestrel.Core.Internal;
using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2; using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2;
using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure; using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure;
using Microsoft.AspNetCore.Testing; using Microsoft.AspNetCore.Testing;
using Microsoft.AspNetCore.Testing.xunit;
using Microsoft.Net.Http.Headers; using Microsoft.Net.Http.Headers;
using Moq; using Moq;
using Xunit; using Xunit;
@ -262,7 +263,8 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests
await sendTask.DefaultTimeout(); await sendTask.DefaultTimeout();
} }
[Fact] [ConditionalFact]
[SkipOnHelix] // https://github.com/aspnet/AspNetCore/issues/7000
public async Task DATA_Sent_TooSlowlyDueToSocketBackPressureOnSmallWrite_AbortsConnectionAfterGracePeriod() public async Task DATA_Sent_TooSlowlyDueToSocketBackPressureOnSmallWrite_AbortsConnectionAfterGracePeriod()
{ {
var mockSystemClock = _serviceContext.MockSystemClock; var mockSystemClock = _serviceContext.MockSystemClock;

View File

@ -30,6 +30,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.InMemory.FunctionalTests.Http2
private static X509Certificate2 _x509Certificate2 = TestResources.GetTestCertificate(); private static X509Certificate2 _x509Certificate2 = TestResources.GetTestCertificate();
[ConditionalFact] [ConditionalFact]
[SkipOnHelix] // https://github.com/aspnet/AspNetCore/issues/7000
public async Task TlsHandshakeRejectsTlsLessThan12() public async Task TlsHandshakeRejectsTlsLessThan12()
{ {
using (var server = new TestServer(context => using (var server = new TestServer(context =>

View File

@ -4,13 +4,12 @@
<TargetFramework>netcoreapp3.0</TargetFramework> <TargetFramework>netcoreapp3.0</TargetFramework>
<ServerGarbageCollection>true</ServerGarbageCollection> <ServerGarbageCollection>true</ServerGarbageCollection>
<TestGroupName>InMemory.FunctionalTests</TestGroupName> <TestGroupName>InMemory.FunctionalTests</TestGroupName>
<!-- // https://github.com/aspnet/AspNetCore/issues/7000 --> </PropertyGroup>
<BuildHelixPayload>false</BuildHelixPayload>
</PropertyGroup>
<ItemGroup> <ItemGroup>
<Compile Include="$(SharedSourceRoot)NullScope.cs" /> <Compile Include="$(SharedSourceRoot)NullScope.cs" />
<Compile Include="$(KestrelSharedSourceRoot)test\*.cs" LinkBase="shared" /> <Compile Include="$(KestrelSharedSourceRoot)test\*.cs" LinkBase="shared" />
<Compile Include="$(SharedSourceRoot)test\SkipOnHelixAttribute.cs" />
<Content Include="$(KestrelSharedSourceRoot)test\TestCertificates\*.pfx" LinkBase="shared\TestCertificates" CopyToOutputDirectory="PreserveNewest" /> <Content Include="$(KestrelSharedSourceRoot)test\TestCertificates\*.pfx" LinkBase="shared\TestCertificates" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup> </ItemGroup>

View File

@ -16,7 +16,7 @@ namespace Microsoft.AspNetCore.Testing.xunit
{ {
get get
{ {
return !string.Equals(Environment.GetEnvironmentVariable("helix"), "true", StringComparison.OrdinalIgnoreCase); return !OnHelix();
} }
} }
@ -27,5 +27,7 @@ namespace Microsoft.AspNetCore.Testing.xunit
return $"This test is skipped on helix"; return $"This test is skipped on helix";
} }
} }
public static bool OnHelix() => string.Equals(Environment.GetEnvironmentVariable("helix"), "true", StringComparison.OrdinalIgnoreCase);
} }
} }