Support methods without streams by testing/codegen#205
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for generating test harnesses for services without streaming methods by introducing conditional generation of WebSocket-related code. The change ensures that non-streaming services don't include unnecessary WebSocket infrastructure in their test harnesses.
- Updates the HTTP harness template to conditionally include WebSocket upgrader and dialer based on whether the service has streaming methods
- Adds test cases to verify correct code generation for both streaming and non-streaming services
- Refactors the stream detection logic to use the
IsStreaming()method instead of direct field comparison
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| testing/codegen/templates/http_harness.go.tpl | Conditionally generates WebSocket code based on .HasStreams template variable |
| testing/codegen/harness.go | Updates stream detection to use IsStreaming() method |
| testing/codegen/harness_test.go | Adds comprehensive tests for both streaming and non-streaming services |
| testing/codegen/testdata/dsls.go | Provides test DSL definitions for services with and without streams |
| testing/codegen/testdata/code.go | Contains expected generated code for test validation |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
Very nice, thank you! |
No description provided.