CCM-15047 - Add/refactor integration tests#51
Merged
mjewildnhs merged 9 commits intomainfrom Mar 18, 2026
Merged
Conversation
5c02337 to
b7e94ae
Compare
ca33db7 to
4eba1de
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors and expands the integration test suite to exercise callback delivery and DLQ behaviors using SQS + an S3-backed debug log bucket, and adds supporting infrastructure toggles for debug logging.
Changes:
- Added Jest global setup/teardown + per-test logging for integration tests, and refactored tests to use new helper modules (SQS, callbacks-from-S3, event factories, redrive).
- Updated mock-webhook lambda to support forced HTTP status codes via
messageIdprefix (for DLQ routing assertions). - Introduced Terraform toggles for enabling the debug-log S3 bucket and parameterizing inbound-event SQS visibility/max-receive settings; adjusted logger S3 debug key scheme to incorporate correlationId.
Reviewed changes
Copilot reviewed 31 out of 32 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/integration/package.json | Adds integration test workspace deps (incl. internal logger/models). |
| tests/integration/jest.config.ts | Enables global setup/teardown and per-test setup; runs serially. |
| tests/integration/jest.setup.ts | Logs test start/finish and flushes logger writes at end. |
| tests/integration/jest.global-setup.ts | Uploads mock subscription config to S3 before integration tests. |
| tests/integration/jest.global-teardown.ts | Removes mock subscription config from S3 after tests. |
| tests/integration/helpers/* | New helper modules for deployment context, clients, SQS, S3 callback polling, status-event processing, and DLQ redrive. |
| tests/integration/event-bus-to-webhook.test.ts | Refactored integration tests and added DLQ coverage. |
| tests/integration/dlq-redrive.test.ts | Refactored redrive test to use helpers and S3 debug log polling. |
| src/logger/src/index.ts | Changes debug-log S3 object key to include correlationId. |
| lambdas/mock-webhook-lambda/src/index.ts | Adds forced status code response behavior based on messageId prefix. |
| lambdas/mock-webhook-lambda/src/tests/index.test.ts | Adds unit tests for forced status code behavior. |
| infrastructure/terraform/components/callbacks/* | Adds enable_debug_log_bucket flag, SQS tunables, and updates debug-bucket wiring/outputs/IAM. |
| eslint.config.mjs | Disables no-relative-import-paths for Jest global setup/teardown and integration helpers. |
| package.json / package-lock.json | Adds flatted override/version changes. |
| docs/adr/assets/ADR-003/examples/python/requirements.txt | Updates PyJWT version in ADR example. |
Comments suppressed due to low confidence (1)
tests/integration/package.json:20
- tests/integration/package.json has duplicated deps between dependencies and devDependencies (e.g. @aws-sdk/client-sqs, async-wait-until), and it still lists AWS SDK clients that are no longer imported anywhere in tests/integration (cloudwatch-logs, eventbridge, sts). This increases install surface and can confuse dependency intent; please remove duplicates and drop unused AWS clients.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
sidnhs
approved these changes
Mar 17, 2026
5ecd4e3 to
742ef18
Compare
d80d4e5 to
a765162
Compare
Run IT tests sequentially Use correlation id in s3 debug log key Filter s3 debug objects using message id and ensure uuid ííTerraform vars to support DLQ test Add listbucket permission to transform filter lambda As per the docs: "If you have the s3:ListBucket permission on the bucket, Amazon S3 returns an HTTP status code 404 Not Found error. If you don’t have the s3:ListBucket permission, Amazon S3 returns an HTTP status code 403 Access Denied error." Refactor DLQ jest global setup/teardown start / end time test logging Split aws-helpers up Move flushLogs out to shared teardown Standardise test timeout Simplify DLQ url Update dependencies to resolve CVEs
a765162 to
417c3e9
Compare
cgitim
approved these changes
Mar 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Add ITs to cover callback delivery and DLQ behaviour.
Refactor existing ITs and helper functions.
Context
To strengthen IT coverage.
Details
Infrastructure (Terraform)
enable_debug_log_bucketvariable decouples the debug S3 log bucket fromdeploy_mock_webhook.Mock webhook lambda
messageIdin an incoming callback starts withforce-{code}-(e.g.force-500-abc), the lambda returns that HTTP status code. This allows integration tests to exercise retry and DLQ paths without external failure injection.force-400-andforce-500-cases.Integration tests (major refactor)
describe.skip— they are now enabled and fully runnable.jest.global-setup.ts/jest.global-teardown.ts): uploads and cleans up a mock client subscription config in S3 around the full test runjest.setup.ts: per-test structured log markers ([TEST START]/[TEST FINISH]with duration) to aid debugging slow/stuck testsaws-helpers.tshas been replaced with focused modulesType of changes
Checklist
Sensitive Information Declaration
To ensure the utmost confidentiality and protect your and others privacy, we kindly ask you to NOT including PII (Personal Identifiable Information) / PID (Personal Identifiable Data) or any other sensitive data in this PR (Pull Request) and the codebase changes. We will remove any PR that do contain any sensitive information. We really appreciate your cooperation in this matter.