[Fixes #19666] [Components] Improve reliability of component quarantined tests (take 2) (#21499)

* Tries to increase the reliability of the tests by:
  * Trying to ensure that the server is up and running before connecting.
  * Retrying a connection attempt multiple times.
This commit is contained in:
Javier Calvarro Nelson 2020-05-06 19:12:06 +02:00 committed by GitHub
parent fdb0372a67
commit a9d702624a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 41 additions and 1 deletions

View File

@ -359,7 +359,19 @@ namespace Ignitor
HubConnection.On<string>("JS.Error", OnError);
HubConnection.Closed += OnClosedAsync;
await HubConnection.StartAsync(CancellationToken);
for (var i = 0; i < 10; i++)
{
try
{
await HubConnection.StartAsync(CancellationToken);
break;
}
catch
{
await Task.Delay(500);
// Retry 10 times
}
}
if (!connectAutomatically)
{

View File

@ -2,6 +2,8 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Net;
using System.Net.Http;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components.E2ETest.Infrastructure.ServerFixtures;
@ -22,6 +24,32 @@ namespace Microsoft.AspNetCore.Components.E2ETest.ServerExecutionTests
{
}
protected override async Task InitializeAsync()
{
await base.InitializeAsync();
var rootUri = ServerFixture.RootUri;
var baseUri = new Uri(rootUri, "/subdir");
var client = new HttpClient();
for (var i = 0; i < 10; i++)
{
try
{
var response = await client.GetAsync(baseUri + "/_negotiate");
if (response.StatusCode == HttpStatusCode.OK)
{
break;
}
}
catch
{
await Task.Delay(500);
throw;
}
}
}
[Fact]
[QuarantinedTest("https://github.com/dotnet/aspnetcore/issues/19414")]
public async Task CannotStartMultipleCircuits()