Skip to content

Improve SignalR tests to use channel #57156

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

Merged
merged 1 commit into from
Aug 5, 2024
Merged

Conversation

JamesNK
Copy link
Member

@JamesNK JamesNK commented Aug 3, 2024

Fix race when getting activity. Using a channel gives the test the opportunity to wait for the activity to be ready.

| [0.003s] TestLifetime Information: Starting test StreamingHubMethodCreatesActivities_ReadTraceHeaders at 2024-08-02T13:53:58
| [0.007s] Microsoft.AspNetCore.SignalR.Internal.DefaultHubProtocolResolver Debug: Registered SignalR Protocol: json, implemented by Microsoft.AspNetCore.SignalR.Protocol.JsonHubProtocol.
| [0.007s] Microsoft.AspNetCore.SignalR.Internal.DefaultHubProtocolResolver Debug: Registered SignalR Protocol: messagepack, implemented by Microsoft.AspNetCore.SignalR.Protocol.MessagePackHubProtocol.
| [0.025s] Microsoft.AspNetCore.SignalR.HubConnectionHandler Debug: OnConnectedAsync started.
| [0.025s] Microsoft.AspNetCore.SignalR.Internal.DefaultHubProtocolResolver Debug: Found protocol implementation for requested protocol: json.
| [0.025s] Microsoft.AspNetCore.SignalR.HubConnectionContext Debug: Completed connection handshake. Using HubProtocol 'json'.
| [0.034s] Microsoft.AspNetCore.SignalR.Tests.HubConnectionHandlerTests Error: Test threw an exception.
| Xunit.Sdk.SingleException: The collection was expected to contain a single element, but it was empty.
|    at Xunit.Assert.GetSingleResult[T](IEnumerable`1 collection, Predicate`1 predicate, String expectedArgument) in /_/src/xunit.assert/Asserts/CollectionAsserts.cs:line 628
|    at Xunit.Assert.Single[T](IEnumerable`1 collection) in /_/src/xunit.assert/Asserts/CollectionAsserts.cs:line 588
|    at Microsoft.AspNetCore.SignalR.Tests.HubConnectionHandlerTests.StreamingHubMethodCreatesActivities_ReadTraceHeaders() in /_/src/SignalR/server/SignalR/test/Microsoft.AspNetCore.SignalR.Tests/HubConnectionHandlerTests.Activity.cs:line 258
|    at Xunit.Sdk.TestInvoker`1.<>c__DisplayClass48_0.<<InvokeTestMethodAsync>b__1>d.MoveNext() in /_/src/xunit.execution/Sdk/Frameworks/Runners/TestInvoker.cs:line 264
| --- End of stack trace from previous location ---
|    at Xunit.Sdk.ExecutionTimer.AggregateAsync(Func`1 asyncAction) in /_/src/xunit.execution/Sdk/Frameworks/ExecutionTimer.cs:line 48
|    at Xunit.Sdk.ExceptionAggregator.RunAsync(Func`1 code) in /_/src/xunit.core/Sdk/ExceptionAggregator.cs:line 90
| [0.037s] TestLifetime Information: Finished test StreamingHubMethodCreatesActivities_ReadTraceHeaders in 0.0335153s

@JamesNK JamesNK added the area-signalr Includes: SignalR clients and servers label Aug 3, 2024
@JamesNK JamesNK merged commit b4558f7 into main Aug 5, 2024
26 checks passed
@JamesNK JamesNK deleted the jamesnk/signalr-tests-channel branch August 5, 2024 22:13
@dotnet-policy-service dotnet-policy-service bot added this to the 9.0-rc1 milestone Aug 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-signalr Includes: SignalR clients and servers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants