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

Automated smoke test #220

Open
NoxHarmonium opened this issue Mar 11, 2021 · 0 comments
Open

Automated smoke test #220

NoxHarmonium opened this issue Mar 11, 2021 · 0 comments
Labels
tech debt Improvements to existing codebase, automated testing etc.

Comments

@NoxHarmonium
Copy link
Collaborator

NoxHarmonium commented Mar 11, 2021

Before I merge a PR I usually do a smoke test which involves:

  • Checking out the PR branch
  • Building the library
  • Deploying the example project to a sandbox AWS environment
  • Firing an event though and checking the logs to see if it worked

We can automate this process to make it quicker to merge PRs.

We already have a CI pipeline that runs via github actions and builds/tests the library. We just need to write an integration test step. I have already done a similar thing in one of my personal projects, so that might be a good reference.

In my personal project, when the CI runs, it changes into the directory of the example project and runs the "integration-test" yarn task.
That then calls a bash script: https://github.com/NoxHarmonium/io-ts-serverless-handler/blob/master/packages/io-ts-serverless-handler-example/scripts/integration-test.sh

The main things that the above script does that is nice to have is:

  • Has a trap that cleans up the infra if an error occurs
  • Generates a stage name from the git commit so that a fresh deployment is run every time
  • Some checks for tools/credentials

The hard part would be writing the part of the script that verifies if the deployment is working. My current thinking is:

  • Update the example project so that incoming events are dumped to an s3 bucket as JSON files
  • Fire an SNS event from the command line, which should then end up in a queue and then picked up by the lambda. Then poll the S3 bucket until the event file appears
  • Do a simple check on the event using jq
@NoxHarmonium NoxHarmonium added the tech debt Improvements to existing codebase, automated testing etc. label Jun 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tech debt Improvements to existing codebase, automated testing etc.
Projects
None yet
Development

No branches or pull requests

1 participant