Unit test cleanup for WebSocket connect and mock multi-match expectations#982
Open
jhugard wants to merge 5 commits into
Open
Unit test cleanup for WebSocket connect and mock multi-match expectations#982jhugard wants to merge 5 commits into
jhugard wants to merge 5 commits into
Conversation
jasonsandlin
approved these changes
May 21, 2026
| result->errorCode = S_OK; | ||
| result->websocket = websocket; | ||
| return S_OK; | ||
| } |
Member
There was a problem hiding this comment.
Now that the provider returns a proper WebSocketCompletionResult, it might be worth adding an end-to-end assertion in TestConnect — call HCGetWebSocketConnectResult after the async completes and verify connectResult.errorCode == S_OK and connectResult.websocket == websocket. Would fully exercise the new GetResult path.
Collaborator
Author
There was a problem hiding this comment.
Now that the provider returns a proper
WebSocketCompletionResult, it might be worth adding an end-to-end assertion inTestConnect— callHCGetWebSocketConnectResultafter the async completes and verifyconnectResult.errorCode == S_OKandconnectResult.websocket == websocket. Would fully exercise the newGetResultpath.
Done.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This branch cleans up two unit-test regressions on top of
mainand restores the Windows Debug x64 TAEF suite to green.The first fix is a direct follow-on to PR #961, which updated the WebSocket connect completion path to always consume the async connect result via
HCGetWebSocketConnectResult(). However, the WebSocket unit-test connect stubs were still using an incomplete fake-provider contract.The second fix is a direct follow-on to PR #979 and cleans up a stale mock multi-match expectation. That PR intentionally changed mock multi-match selection from stack-style behavior to round-robin behavior, but
MockTests::ExampleMultiSpecificUrlBodyMockstill asserted the old behavior.Included Fixes
1. WebSocket connect test contract cleanup
File changed:
Tests/UnitTests/Tests/WebsocketTests.cppWhat changed:
Test_Internal_HCWebSocketConnectAsyncreinterpret_cast<void*>(HCWebSocketConnectAsync)sizeof(WebSocketCompletionResult)XAsyncOp::GetResultTest_Internal_HCWebSocketConnectAsyncAndClosereinterpret_cast<void*>(HCWebSocketConnectAsync)TestWebSocketConnectAndCloseProvider::ConnectAsyncreinterpret_cast<void*>(HCWebSocketConnectAsync)Why:
After PR #961, the fake connect providers in the test harness must satisfy the same XAsync identity and result-payload contract as real providers, otherwise
HCGetWebSocketConnectResult()fails andWebsocketTests::TestConnectno longer represents a valid provider implementation.Commit on this branch:
0b118889c44db3afe56d23263f73c67562dd7704-Fix websocket connect test async result contract2. Mock multi-match expectation cleanup
File changed:
Tests/UnitTests/Tests/MockTests.cppWhat changed:
ExampleMultiSpecificUrlBodyMocknow expects the post-PR improve multi mock behavior #979 round-robin mock multi-match behavior instead of the older newest-match-wins behavior.Why:
The first failing commit for the next failing test was:
ab6a11bd31a28ccc9c98b6858fe170a665040a1a-improve multi mock behavior (#979)That commit intentionally changed mock multi-match selection to round-robin and explicitly says so in the commit message body. The test was never updated, so
MockTests::ExampleMultiSpecificUrlBodyMockbecame stale even though the new behavior was intentional.Commit on this branch:
e7b2e7661aeab65e258599e4e345dfa72e1214f6-Update mock multi-match test for round-robin behaviorValidation
Validated on clean branch
user/jhugard/unit-test-cleanupfrommain:xbox::httpclienttest::WebsocketTests::TestConnectpassesxbox::httpclienttest::MockTests::ExampleMultiSpecificUrlBodyMockpassesSummary: Total=87, Passed=87, Failed=0, Blocked=0, Not Run=0, Skipped=0Additional regression confirmation during the earlier bisect work:
0fa5f24changed isolatedTestConnectfrom hang/failure to pass0fa5f24TAEF DLL completed with:Summary: Total=84, Passed=84, Failed=0, Blocked=0, Not Run=0, Skipped=0