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

codegen: middleware snapshot tests #502

Merged
merged 2 commits into from
Feb 22, 2024
Merged

Conversation

lucix-aws
Copy link
Contributor

@lucix-aws lucix-aws commented Feb 21, 2024

Adds codegen integration to generate middleware snapshot tests.

Other minor things

  • Adds the ability to set build tags in a writer
  • Adds a new formatter to inject wholesale imports

@lucix-aws lucix-aws requested review from a team as code owners February 21, 2024 22:25
));
}

private GoWriter.Writable testCheckSnapshot(OperationShape operation, SymbolProvider symbolProvider) {
Copy link
Contributor

Choose a reason for hiding this comment

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

One question, if a user want to test an op's stack snapshot, does he need to add updateSnapshot and testSnapshot into APIOptions in order?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, none of this is user-facing. The generated test code handles calling these functions for us.

return err
}
if actual := stack.String(); actual != string(expected) {
return fmt.Errorf("%s != %s", expected, actual)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it'd be better to use a dedicated diff tool, but that can be an incremental improvement.

@lucix-aws lucix-aws merged commit 0dbd505 into main Feb 22, 2024
11 checks passed
@lucix-aws lucix-aws deleted the middleware-snapshot-tests branch February 22, 2024 18:07
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