-
Notifications
You must be signed in to change notification settings - Fork 210
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
Use WebSocket fakes #3714
base: master
Are you sure you want to change the base?
Use WebSocket fakes #3714
Conversation
Refactor serve_handler_test to use the `fakes` utility from the `web_socket` package instead of reimplement it locally. Currently this changes the behavior of the tests and they fail.
cc @brianquinlan - are behavior differences expected from this type of refactoring? I would have hoped that the different fake implementations behave the same, and that wrapping a Opening this as the PR to have a place to see and discuss the differences. |
I'm surprised that the tests fail. Are you seeing the failures locally because the github CI seems to get hung-up at the analysis phase. |
Ah yeah, I had hoped to see the error on CI too, I'll fix up analysis and copy the logs in the meantime. These stream matcher tests are unfortunately not very nice to debug so the log output isn't as useful as making changes in the test. local failure
|
Intention is to tighten the constraint, but the diagnostic has a false positive
Let me patch this in and take a look. |
The data seems to be flowing correctly but something is probably getting closed or not listed too early. The tests pass with this change test('emmits a message to all listners', () async {
expect(clientChannel1.stream, emitsInOrder(['{}', emitsDone]));
expect(clientChannel2.stream, emitsInOrder(['{}', emitsDone]));
await createMockConnection(serverChannel1, 'web');
await createMockConnection(serverChannel2, 'web');
await handler.emitUpdateMessage(BuildResult(BuildStatus.success, []));
+ await Future.delayed(const Duration(seconds: 5));
await clientChannel1.sink.close();
await clientChannel2.sink.close();
});
|
The data gets received by the fake
But the data does not seem to appear in the |
I'll play around with this some more next week. If the failure is only exposing some way that the test was too sensitive about async interleaving then I'm not too concerned about the difference impacting production use. |
Resolves some tests which were sensitive to particular async event counts in ways that should not impact the production code. Only a microtask is required, so these could be `await null`. Use `pumpEventQueue()` anyway so the intent is clear.
I added some There is one remaining failure which I'll look at more tomorrow. |
No concerns |
Refactor serve_handler_test to use the
fakes
utility from theweb_socket
package instead of reimplement it locally.Currently this changes the behavior of the tests and they fail.