File tree Expand file tree Collapse file tree 1 file changed +28
-2
lines changed
src/SignalR/common/testassets/Tests.Utils Expand file tree Collapse file tree 1 file changed +28
-2
lines changed Original file line number Diff line number Diff line change 1
- // Copyright (c) .NET Foundation. All rights reserved.
1
+ // Copyright (c) .NET Foundation. All rights reserved.
2
2
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3
3
4
4
using System ;
@@ -34,6 +34,32 @@ public void Dispose()
34
34
35
35
var results = _sink . GetLogs ( ) . Where ( w => w . Write . LogLevel >= LogLevel . Error ) . ToList ( ) ;
36
36
37
+ #if NETCOREAPP2_1 || NETCOREAPP2_2 || NET461
38
+ // -- Remove this code after 2.2 --
39
+ // This section of code is resolving test flakiness caused by a race in LongPolling
40
+ // The race has been resolved in version 3.0
41
+ // The below code tries to find is a DELETE request has arrived from the client before removing error logs associated with the race
42
+ // We do this because we don't want to hide any actual issues, but we feel confident that looking for DELETE first wont hide any real problems
43
+ var foundDelete = false ;
44
+ var allLogs = _sink . GetLogs ( ) ;
45
+ foreach ( var log in allLogs )
46
+ {
47
+ if ( foundDelete == false && log . Write . Message . Contains ( "Request starting" ) && log . Write . Message . Contains ( "DELETE" ) )
48
+ {
49
+ foundDelete = true ;
50
+ }
51
+
52
+ if ( foundDelete )
53
+ {
54
+ if ( ( log . Write . EventId . Name == "LongPollingTerminated" || log . Write . EventId . Name == "ApplicationError" || log . Write . EventId . Name == "FailedDispose" )
55
+ && log . Write . Exception ? . Message . Contains ( "Reading is not allowed after reader was completed." ) == true )
56
+ {
57
+ results . Remove ( log ) ;
58
+ }
59
+ }
60
+ }
61
+ #endif
62
+
37
63
if ( _expectedErrorsFilter != null )
38
64
{
39
65
results = results . Where ( w => ! _expectedErrorsFilter ( w . Write ) ) . ToList ( ) ;
@@ -64,4 +90,4 @@ public void Dispose()
64
90
}
65
91
}
66
92
}
67
- }
93
+ }
You can’t perform that action at this time.
0 commit comments