[Identity] Fix flaky test (#12771)
This commit is contained in:
parent
9e6924235e
commit
2969001a75
|
|
@ -26,7 +26,7 @@ namespace Microsoft.AspNetCore.Identity.FunctionalTests.Bootstrap3Tests
|
|||
var hasV3Part = false;
|
||||
var hasV4Part = false;
|
||||
var factory = Factory.WithWebHostBuilder(
|
||||
whb => whb.UseStartup<Startup>().ConfigureServices(
|
||||
whb => whb.ConfigureServices(
|
||||
services => services.AddMvc().ConfigureApplicationPartManager(
|
||||
apm => (hasV3Part, hasV4Part) = (HasPart(apm, "V3"), HasPart(apm, "V4")))));
|
||||
|
||||
|
|
|
|||
|
|
@ -37,13 +37,10 @@ namespace Microsoft.AspNetCore.Identity.FunctionalTests
|
|||
}
|
||||
|
||||
public string BootstrapFrameworkVersion { get; set; } = "V4";
|
||||
private bool IsHelixCI => typeof(ServerFactory<,>).Assembly.GetCustomAttributes<AssemblyMetadataAttribute>()
|
||||
.Any(a => a.Key == "Microsoft.AspNetCore.Testing.IsHelixCI");
|
||||
|
||||
protected override IHostBuilder CreateHostBuilder()
|
||||
{
|
||||
Program.UseStartup = false;
|
||||
return base.CreateHostBuilder();
|
||||
return Program.CreateHostBuilder(new[] { "--use-startup=false" });
|
||||
}
|
||||
|
||||
protected override void ConfigureWebHost(IWebHostBuilder builder)
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
|
|
@ -17,13 +18,11 @@ namespace Identity.DefaultUI.WebSite
|
|||
CreateHostBuilder(args).Build().Run();
|
||||
}
|
||||
|
||||
public static bool UseStartup { get; set; } = true;
|
||||
|
||||
public static IHostBuilder CreateHostBuilder(string[] args) =>
|
||||
Host.CreateDefaultBuilder(args)
|
||||
.ConfigureWebHostDefaults(webBuilder =>
|
||||
{
|
||||
if (UseStartup)
|
||||
if (!args.Contains("--use-startup=false"))
|
||||
{
|
||||
webBuilder.UseStartup<Startup>();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue