Fix more flaky tests (#1750)

This commit is contained in:
Mikael Mengistu 2018-03-28 15:27:40 -07:00 committed by GitHub
parent 8c84518ecc
commit eb2fa9bacd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 6 deletions

View File

@ -83,13 +83,22 @@ namespace Microsoft.AspNetCore.SignalR.Client.Tests
[Theory]
[InlineData(2)]
[InlineData(3)]
public async Task TransportThatFailsToStartOnceFallsBack(int passThreshold)
public async Task TransportThatFailsToStartFallsBack(int passThreshold)
{
using (StartLog(out var loggerFactory))
{
var startCounter = 0;
var expected = new Exception("Transport failed to start");
// We have 4 cases here. Falling back once, falling back twice and each of these
// with WebSockets available and not. If Websockets aren't available and
// we can't to test the fallback once scenario we don't decrement the passthreshold
// because we still try to start twice (SSE and LP).
if (!IsWebSocketsSupported() && passThreshold > 2)
{
passThreshold -= 1;
}
Task OnTransportStart()
{
startCounter++;
@ -112,11 +121,6 @@ namespace Microsoft.AspNetCore.SignalR.Client.Tests
{
Assert.Equal(0, startCounter);
await connection.StartAsync(TransferFormat.Text);
if (!IsWebSocketsSupported())
{
passThreshold -= 1;
}
Assert.Equal(passThreshold, startCounter);
});
}