agiledigital / agiledigital/serverless-sns-sqs-lambda

Automated smoke test

Đang mở
#220 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
tech debt
Ngôn ngữ chính
TypeScript
Star
85
Fork
20
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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`

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.