Skip to content

Commit a2c8a34

Browse files
authored
Reenable some helix tests (#7763)
* Fix identity UI script tests on helix * Add OnHelix static helper method
1 parent 40b2a94 commit a2c8a34

File tree

11 files changed

+48
-18
lines changed

11 files changed

+48
-18
lines changed

src/Identity/test/Identity.Test/IdentityUIScriptsTest.cs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ public static IEnumerable<object[]> ScriptWithIntegrityData
3838
}
3939
}
4040

41-
[ConditionalTheory]
42-
[SkipOnHelix] // https://github.com/aspnet/AspNetCore/issues/6549
41+
[Theory]
4342
[MemberData(nameof(ScriptWithIntegrityData))]
4443
public async Task IdentityUI_ScriptTags_SubresourceIntegrityCheck(ScriptTag scriptTag)
4544
{
@@ -68,8 +67,7 @@ public static IEnumerable<object[]> ScriptWithFallbackSrcData
6867
}
6968
}
7069

71-
[ConditionalTheory]
72-
[SkipOnHelix] // https://github.com/aspnet/AspNetCore/issues/6549
70+
[Theory]
7371
[MemberData(nameof(ScriptWithFallbackSrcData))]
7472
public async Task IdentityUI_ScriptTags_FallbackSourceContent_Matches_CDNContent(ScriptTag scriptTag)
7573
{
@@ -148,13 +146,17 @@ private static List<ScriptTag> GetScriptTags(string cshtmlFile)
148146
private static string GetSolutionDir()
149147
{
150148
var dir = new DirectoryInfo(AppContext.BaseDirectory);
151-
while (dir != null)
149+
// On helix we use the published copy
150+
if (!SkipOnHelixAttribute.OnHelix())
152151
{
153-
if (File.Exists(Path.Combine(dir.FullName, "Identity.sln")))
152+
while (dir != null)
154153
{
155-
break;
154+
if (File.Exists(Path.Combine(dir.FullName, "Identity.sln")))
155+
{
156+
break;
157+
}
158+
dir = dir.Parent;
156159
}
157-
dir = dir.Parent;
158160
}
159161
return dir.FullName;
160162
}

src/Identity/test/Identity.Test/Microsoft.AspNetCore.Identity.Test.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
<ItemGroup>
88
<Compile Include="$(IdentityTestSharedSourceRoot)**\*.cs" />
99
<Compile Include="$(SharedSourceRoot)test\SkipOnHelixAttribute.cs" />
10+
<HelixContent Include="..\..\UI\src\Areas\Identity\Pages\**\*.*" LinkBase="UI\src\Areas\Identity\Pages" />
11+
<HelixContent Include="..\..\UI\src\wwwroot\**\*.*" LinkBase="UI\src\wwwroot" />
1012
</ItemGroup>
1113

1214
<ItemGroup>

src/Mvc/Mvc.Analyzers/test/Infrastructure/MvcTestSource.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
// Copyright (c) .NET Foundation. All rights reserved.
22
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
33

4+
using System;
45
using System.IO;
56
using Microsoft.AspNetCore.Analyzer.Testing;
67
using Microsoft.AspNetCore.Testing;
8+
using Microsoft.AspNetCore.Testing.xunit;
79

810
namespace Microsoft.AspNetCore.Mvc
911
{
@@ -25,6 +27,12 @@ public static TestSource Read(string testClassName, string testMethod)
2527

2628
private static string GetProjectDirectory()
2729
{
30+
// On helix we use the published test files
31+
if (SkipOnHelixAttribute.OnHelix())
32+
{
33+
return AppContext.BaseDirectory;
34+
}
35+
2836
var solutionDirectory = TestPathUtilities.GetSolutionRootDirectory("Mvc");
2937
var projectDirectory = Path.Combine(solutionDirectory, "Mvc.Analyzers", "test");
3038
return projectDirectory;

src/Mvc/Mvc.Analyzers/test/Mvc.Analyzers.Test.csproj

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@
44
<TargetFramework>netcoreapp3.0</TargetFramework>
55
<PreserveCompilationContext>true</PreserveCompilationContext>
66
<RootNamespace>Microsoft.AspNetCore.Mvc.Analyzers</RootNamespace>
7-
<!-- https://github.com/aspnet/AspNetCore/issues/6549 -->
7+
<!-- https://github.com/aspnet/AspNetCore/issues/6549 -->
88
<BuildHelixPayload>false</BuildHelixPayload>
9-
</PropertyGroup>
9+
</PropertyGroup>
1010

1111
<ItemGroup>
1212
<None Include="xunit.runner.json" CopyToOutputDirectory="PreserveNewest" />
13+
<Compile Include="$(SharedSourceRoot)test\SkipOnHelixAttribute.cs" />
14+
<Content Include="TestFiles\**\*.*" CopyToPublishDirectory="PreserveNewest" />
1315
</ItemGroup>
1416

1517
<ItemGroup>

src/Mvc/Mvc.Api.Analyzers/test/Infrastructure/MvcTestSource.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
// Copyright (c) .NET Foundation. All rights reserved.
22
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
33

4+
using System;
45
using System.IO;
56
using Microsoft.AspNetCore.Analyzer.Testing;
67
using Microsoft.AspNetCore.Testing;
8+
using Microsoft.AspNetCore.Testing.xunit;
79

810
namespace Microsoft.AspNetCore.Mvc
911
{
@@ -25,6 +27,12 @@ public static TestSource Read(string testClassName, string testMethod)
2527

2628
private static string GetProjectDirectory()
2729
{
30+
// On helix we use the published test files
31+
if (SkipOnHelixAttribute.OnHelix())
32+
{
33+
return AppContext.BaseDirectory;
34+
}
35+
2836
var solutionDirectory = TestPathUtilities.GetSolutionRootDirectory("Mvc");
2937
var projectDirectory = Path.Combine(solutionDirectory, "Mvc.Api.Analyzers", "test");
3038
return projectDirectory;

src/Mvc/Mvc.Api.Analyzers/test/Mvc.Api.Analyzers.Test.csproj

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@
33
<PropertyGroup>
44
<TargetFramework>netcoreapp3.0</TargetFramework>
55
<RootNamespace>Microsoft.AspNetCore.Mvc.Api.Analyzers</RootNamespace>
6-
<!-- https://github.com/aspnet/AspNetCore/issues/6549 -->
6+
<!-- https://github.com/aspnet/AspNetCore/issues/6549 -->
77
<BuildHelixPayload>false</BuildHelixPayload>
8-
</PropertyGroup>
8+
</PropertyGroup>
99

1010
<ItemGroup>
1111
<Compile Include="..\..\Mvc.Analyzers\test\Infrastructure\MvcDiagnosticAnalyzerRunner.cs" Link="Infrastructure\MvcDiagnosticAnalyzerRunner.cs" />
12+
<Compile Include="$(SharedSourceRoot)test\SkipOnHelixAttribute.cs" />
13+
<Content Include="TestFiles\**\*.*" CopyToPublishDirectory="PreserveNewest" />
1214
</ItemGroup>
1315

1416
<ItemGroup>

src/Servers/Kestrel/test/InMemory.FunctionalTests/Http2/Http2StreamTests.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
using Microsoft.AspNetCore.Server.Kestrel.Core.Features;
1717
using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2;
1818
using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2.HPack;
19+
using Microsoft.AspNetCore.Testing.xunit;
1920
using Microsoft.Extensions.Logging;
2021
using Microsoft.Net.Http.Headers;
2122
using Xunit;
@@ -1015,7 +1016,8 @@ await InitializeConnectionAsync(async context =>
10151016
Assert.IsType<Http2StreamErrorException>(thrownEx.InnerException);
10161017
}
10171018

1018-
[Fact]
1019+
[ConditionalFact]
1020+
[SkipOnHelix] // https://github.com/aspnet/AspNetCore/issues/7000
10191021
public async Task ContentLength_Received_ReadViaPipes()
10201022
{
10211023
await InitializeConnectionAsync(async context =>

src/Servers/Kestrel/test/InMemory.FunctionalTests/Http2/Http2TimeoutTests.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2;
1212
using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure;
1313
using Microsoft.AspNetCore.Testing;
14+
using Microsoft.AspNetCore.Testing.xunit;
1415
using Microsoft.Net.Http.Headers;
1516
using Moq;
1617
using Xunit;
@@ -262,7 +263,8 @@ await WaitForConnectionErrorAsync<Http2ConnectionErrorException>(
262263
await sendTask.DefaultTimeout();
263264
}
264265

265-
[Fact]
266+
[ConditionalFact]
267+
[SkipOnHelix] // https://github.com/aspnet/AspNetCore/issues/7000
266268
public async Task DATA_Sent_TooSlowlyDueToSocketBackPressureOnSmallWrite_AbortsConnectionAfterGracePeriod()
267269
{
268270
var mockSystemClock = _serviceContext.MockSystemClock;

src/Servers/Kestrel/test/InMemory.FunctionalTests/Http2/TlsTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ public class TlsTests : LoggedTest
3030
private static X509Certificate2 _x509Certificate2 = TestResources.GetTestCertificate();
3131

3232
[ConditionalFact]
33+
[SkipOnHelix] // https://github.com/aspnet/AspNetCore/issues/7000
3334
public async Task TlsHandshakeRejectsTlsLessThan12()
3435
{
3536
using (var server = new TestServer(context =>

src/Servers/Kestrel/test/InMemory.FunctionalTests/InMemory.FunctionalTests.csproj

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@
44
<TargetFramework>netcoreapp3.0</TargetFramework>
55
<ServerGarbageCollection>true</ServerGarbageCollection>
66
<TestGroupName>InMemory.FunctionalTests</TestGroupName>
7-
<!-- // https://github.com/aspnet/AspNetCore/issues/7000 -->
8-
<BuildHelixPayload>false</BuildHelixPayload>
9-
</PropertyGroup>
7+
</PropertyGroup>
108

119
<ItemGroup>
1210
<Compile Include="$(SharedSourceRoot)NullScope.cs" />
1311
<Compile Include="$(KestrelSharedSourceRoot)test\*.cs" LinkBase="shared" />
12+
<Compile Include="$(SharedSourceRoot)test\SkipOnHelixAttribute.cs" />
1413
<Content Include="$(KestrelSharedSourceRoot)test\TestCertificates\*.pfx" LinkBase="shared\TestCertificates" CopyToOutputDirectory="PreserveNewest" />
1514
</ItemGroup>
1615

src/Shared/test/SkipOnHelixAttribute.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public bool IsMet
1616
{
1717
get
1818
{
19-
return !string.Equals(Environment.GetEnvironmentVariable("helix"), "true", StringComparison.OrdinalIgnoreCase);
19+
return !OnHelix();
2020
}
2121
}
2222

@@ -27,5 +27,7 @@ public string SkipReason
2727
return $"This test is skipped on helix";
2828
}
2929
}
30+
31+
public static bool OnHelix() => string.Equals(Environment.GetEnvironmentVariable("helix"), "true", StringComparison.OrdinalIgnoreCase);
3032
}
3133
}

0 commit comments

Comments
 (0)