Skip to content
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

Modify and Merge protocol test request unit tests codegen logic #447

Merged
merged 5 commits into from
Aug 18, 2023

Conversation

wty-Bryant
Copy link
Contributor

Modify and Merge protocol test request unit tests codegen logic to isolate cases from local server and instead capture and check request directly via middleware

@wty-Bryant wty-Bryant requested review from a team as code owners August 16, 2023 21:08
@wty-Bryant wty-Bryant closed this Aug 16, 2023
@wty-Bryant wty-Bryant deleted the feat-protocol-test-2 branch August 16, 2023 22:03
@wty-Bryant wty-Bryant restored the feat-protocol-test-2 branch August 16, 2023 22:04
@wty-Bryant wty-Bryant reopened this Aug 16, 2023
writer.addUseImports(SmithyGoDependency.CONTEXT);
writer.write("result, err := $L.$T(context.Background(), c.Params)", clientName, opSymbol);
writer.openBlock("result, err := $L.$T(context.Background(), c.Params, func(options *Options) {", "})",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: in the future, we should avoid using a series of openBlocks like this, and just rely on gofmt to do all the formatting. see something like this
https://github.com/aws/smithy-go/blob/main/codegen/smithy-go-codegen/src/main/java/software/amazon/smithy/go/codegen/endpoints/EndpointMiddlewareGenerator.java#L266

@@ -282,7 +274,8 @@ protected void generateTestServer(
String name,
Consumer<GoWriter> handler
) {
super.generateTestServer(writer, name, handler);
// We aren't using a test server, but we do need a URL to set.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: actually this comment doesnt do a lot of good when its generated. because the generated code wont have this comment. if we can, we should make the URL value even more obvious that its a placeholder (while still being parse-able by whatever needs it). for example, would http://thisisa.placeholder:4242 work?

@wty-Bryant wty-Bryant merged commit fdfa00c into main Aug 18, 2023
60 checks passed
@wty-Bryant wty-Bryant deleted the feat-protocol-test-2 branch August 18, 2023 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants