agiledigital / agiledigital/serverless-sns-sqs-lambda

Automated smoke test

Offen
#220 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
tech debt
Vorherrschende Sprache
TypeScript
Sterne
85
Forks
20
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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`

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.