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

chore: Add snapshot test for Go stacks #313

Merged
merged 1 commit into from
Oct 11, 2024
Merged

Conversation

lym953
Copy link
Contributor

@lym953 lym953 commented Oct 10, 2024

What does this PR do?

Add a Go stack to snapshot tests, so that the test will compare the snapshots generated after vs before, to check if a PR causes unexpected changes on the stack to be deployed.

The stack was copied from examples/go-stack. I had to copy it because I don't think it's possible to just reference the existing stack.

Motivation

Adding more tests to make it safer to deploy changes.

Testing Guidelines

To ensure the example stack uses the locally built Go package instead of the production package, I:

  1. Add a line to applyEnvVariables() in env.ts:
lam.addEnvironment("Ah", "Oh");

so an extra environment variable will be added to the Lambda function.

  1. Run yarn build
  2. Run the snapshot test aws-vault exec sso-serverless-sandbox-account-admin -- scripts/run_integration_tests.sh

Result:
The test failed. The generated snapshot has the new environment variable, which captures the unintended change.

Additional Notes

Types of Changes

  • Bug fix
  • New feature
  • Breaking change
  • Misc (docs, refactoring, dependency upgrade, etc.)

Check all that apply

  • This PR's description is comprehensive
  • This PR contains breaking changes that are documented in the description
  • This PR introduces new APIs or parameters that are documented and unlikely to change in the foreseeable future
  • This PR impacts documentation, and it has been updated (or a ticket has been logged)
  • This PR's changes are covered by the automated tests
  • This PR collects user input/sensitive content into Datadog

@lym953 lym953 requested a review from a team as a code owner October 10, 2024 21:46
@lym953 lym953 force-pushed the yiming.luo/add-go-test branch from e251bab to 4eb07ad Compare October 11, 2024 16:39
@lym953 lym953 merged commit ba9f865 into main Oct 11, 2024
10 checks passed
@lym953 lym953 deleted the yiming.luo/add-go-test branch October 11, 2024 16:50
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.

2 participants