Fix more flaky tests (#1750)
This commit is contained in:
parent
8c84518ecc
commit
eb2fa9bacd
|
|
@ -83,13 +83,22 @@ namespace Microsoft.AspNetCore.SignalR.Client.Tests
|
||||||
[Theory]
|
[Theory]
|
||||||
[InlineData(2)]
|
[InlineData(2)]
|
||||||
[InlineData(3)]
|
[InlineData(3)]
|
||||||
public async Task TransportThatFailsToStartOnceFallsBack(int passThreshold)
|
public async Task TransportThatFailsToStartFallsBack(int passThreshold)
|
||||||
{
|
{
|
||||||
using (StartLog(out var loggerFactory))
|
using (StartLog(out var loggerFactory))
|
||||||
{
|
{
|
||||||
var startCounter = 0;
|
var startCounter = 0;
|
||||||
var expected = new Exception("Transport failed to start");
|
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()
|
Task OnTransportStart()
|
||||||
{
|
{
|
||||||
startCounter++;
|
startCounter++;
|
||||||
|
|
@ -112,11 +121,6 @@ namespace Microsoft.AspNetCore.SignalR.Client.Tests
|
||||||
{
|
{
|
||||||
Assert.Equal(0, startCounter);
|
Assert.Equal(0, startCounter);
|
||||||
await connection.StartAsync(TransferFormat.Text);
|
await connection.StartAsync(TransferFormat.Text);
|
||||||
if (!IsWebSocketsSupported())
|
|
||||||
{
|
|
||||||
passThreshold -= 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
Assert.Equal(passThreshold, startCounter);
|
Assert.Equal(passThreshold, startCounter);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue