Skip to content

Commit 2969001

Browse files
authored
[Identity] Fix flaky test (#12771)
1 parent 9e69242 commit 2969001

File tree

3 files changed

+4
-8
lines changed

3 files changed

+4
-8
lines changed

src/Identity/test/Identity.FunctionalTests/Bootstrap3Tests/UIFramewrokAttributeTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public void DefaultWebSite_DefaultsToBootstrap3()
2626
var hasV3Part = false;
2727
var hasV4Part = false;
2828
var factory = Factory.WithWebHostBuilder(
29-
whb => whb.UseStartup<Startup>().ConfigureServices(
29+
whb => whb.ConfigureServices(
3030
services => services.AddMvc().ConfigureApplicationPartManager(
3131
apm => (hasV3Part, hasV4Part) = (HasPart(apm, "V3"), HasPart(apm, "V4")))));
3232

src/Identity/test/Identity.FunctionalTests/Infrastructure/ServerFactory.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,10 @@ public ServerFactory()
3737
}
3838

3939
public string BootstrapFrameworkVersion { get; set; } = "V4";
40-
private bool IsHelixCI => typeof(ServerFactory<,>).Assembly.GetCustomAttributes<AssemblyMetadataAttribute>()
41-
.Any(a => a.Key == "Microsoft.AspNetCore.Testing.IsHelixCI");
4240

4341
protected override IHostBuilder CreateHostBuilder()
4442
{
45-
Program.UseStartup = false;
46-
return base.CreateHostBuilder();
43+
return Program.CreateHostBuilder(new[] { "--use-startup=false" });
4744
}
4845

4946
protected override void ConfigureWebHost(IWebHostBuilder builder)

src/Identity/testassets/Identity.DefaultUI.WebSite/Program.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
33

44
using System.IO;
5+
using System.Linq;
56
using System.Reflection;
67
using Microsoft.AspNetCore.Hosting;
78
using Microsoft.Extensions.Configuration;
@@ -17,13 +18,11 @@ public static void Main(string[] args)
1718
CreateHostBuilder(args).Build().Run();
1819
}
1920

20-
public static bool UseStartup { get; set; } = true;
21-
2221
public static IHostBuilder CreateHostBuilder(string[] args) =>
2322
Host.CreateDefaultBuilder(args)
2423
.ConfigureWebHostDefaults(webBuilder =>
2524
{
26-
if (UseStartup)
25+
if (!args.Contains("--use-startup=false"))
2726
{
2827
webBuilder.UseStartup<Startup>();
2928
}

0 commit comments

Comments
 (0)