-
Notifications
You must be signed in to change notification settings - Fork 179
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
[Access] Add unit test for websocket controller #6762
base: master
Are you sure you want to change the base?
[Access] Add unit test for websocket controller #6762
Conversation
* Add unit test for websocket controller * Add mock for websocket connection * Add mock for data provider * Add mock for data provider factory * Add mock for websocket connection The WebSocket Controller interacts with: 1. Data Provider: Supplies data to the controller. 2. WebSocket Connection: Handles communication with the client. To properly test the controller's logic, we mock these interactions. Since the controller runs two parallel routines (reader and writer), the tests also ensure both can shut down cleanly. A done channel is used in the tests to coordinate this process.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #6762 +/- ##
==========================================
+ Coverage 39.71% 41.23% +1.51%
==========================================
Files 1332 2064 +732
Lines 123050 182805 +59755
==========================================
+ Hits 48875 75383 +26508
- Misses 69986 101096 +31110
- Partials 4189 6326 +2137
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
There are no tests for error cases. I think we should add them as part of #6642. |
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.
After first round of review - looks good!
Close() error | ||
} | ||
|
||
type GorillaWebsocketConnection struct { |
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.
Please add godoc here
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.
I feel like it's redundant in this case. The intention is pretty clear. What do you think?
Closes: #6635
The WebSocket Controller interacts with:
To properly test the controller's logic, we mock these interactions. Since the controller runs two parallel routines (reader and writer), the tests also ensure both can shut down cleanly.
A done channel is used in the tests to coordinate this process.