[Identity] Fix flaky test (#12771)

This commit is contained in:
Javier Calvarro Nelson 2019-07-31 21:58:10 +02:00 committed by GitHub
parent 9e6924235e
commit 2969001a75
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 8 deletions

View File

@ -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")))));

View File

@ -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)

View File

@ -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>();
}