Repository navigation
fix flaky Microsoft.AspNetCore.SignalR.Client.Tests.TestServerTests.WebSocketsWorks #65928
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -75,6 +75,9 @@ public async Task WebSocketsWorks() | |
| await connection.StartAsync(); | ||
| await connection.InvokeAsync("Echo", originalMessage); | ||
| Assert.True(webSocketFactoryCalled); | ||
|
|
||
| await connection.StopAsync(); | ||
| await host.StopAsync(); | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -130,6 +133,9 @@ public async Task LongPollingWorks() | |
|
|
||
| await connection.StartAsync(); | ||
| await connection.InvokeAsync("Echo", originalMessage); | ||
|
|
||
| await connection.StopAsync(); | ||
| await host.StopAsync(); | ||
|
Comment on lines
+137
to
+138
|
||
| } | ||
| } | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
connection.StopAsync()/host.StopAsync()are only executed on the success path. If an earlier await/Assert throws, cleanup falls back to disposal again and can reintroduce the same race (and can also cause additional error logs duringStartVerifiableLog()disposal). Consider moving the explicit stop calls into afinallyso they run regardless of test failure.