refactor(integration-tests): consolidate lambda code and test structure#1102
Merged
jchrostek-dd merged 4 commits intomainfrom Mar 16, 2026
Merged
refactor(integration-tests): consolidate lambda code and test structure#1102jchrostek-dd merged 4 commits intomainfrom
jchrostek-dd merged 4 commits intomainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Refactors the integration-test harness by consolidating per-stack Lambda handlers into shared default-* handlers and restructuring test invocation/telemetry collection utilities, alongside renaming the “base” stack/tests to “on-demand”.
Changes:
- Replaced per-stack Lambda handler directories with shared
lambda/default-*handlers and updated CDK stacks to point at them. - Reworked test utilities to separate invocation (
invoke.ts) from telemetry collection (default.ts) and updated tests todescribe.eachpatterns. - Renamed the “base” stack/tests to “on-demand” and updated the CDK app entrypoint accordingly.
Reviewed changes
Copilot reviewed 42 out of 46 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| integration-tests/tests/utils/util.ts | Removed legacy invoke+Datadog helper (superseded by new utilities). |
| integration-tests/tests/utils/lambda.ts | Simplified Lambda utilities (publish version / snapstart readiness / cold start). |
| integration-tests/tests/utils/invoke.ts | Added dedicated Lambda invoke helper. |
| integration-tests/tests/utils/default.ts | Added shared invoke + Datadog telemetry collection orchestrator. |
| integration-tests/tests/utils/datadog.ts | Added DatadogTelemetry and request-id based telemetry helper; tightened query signatures. |
| integration-tests/tests/snapstart.test.ts | Refactored SnapStart tests to table-driven runtime iteration + new telemetry utilities. |
| integration-tests/tests/otlp.test.ts | Refactored OTLP tests to new invocation/telemetry utilities. |
| integration-tests/tests/on-demand.test.ts | Added new on-demand test suite (replaces deleted base tests). |
| integration-tests/tests/lmi.test.ts | Refactored LMI tests to new invocation/telemetry utilities. |
| integration-tests/tests/base.test.ts | Removed base test suite (replaced by on-demand). |
| integration-tests/package.json | Updated dependencies (CDK + added AWS SDK clients/uuid). |
| integration-tests/lib/stacks/snapstart.ts | Updated SnapStart stack to use shared handlers and new handler names. |
| integration-tests/lib/stacks/on-demand.ts | Renamed/refactored base stack to on-demand and pointed at shared handlers. |
| integration-tests/lib/stacks/lmi.ts | Updated LMI stack to use shared handlers and added env vars. |
| integration-tests/lambda/snapstart-python/requirements.txt | Removed snapstart-specific Python handler assets. |
| integration-tests/lambda/snapstart-python/lambda_function.py | Removed snapstart-specific Python handler implementation. |
| integration-tests/lambda/snapstart-java/src/main/java/example/SnapstartHandler.java | Removed snapstart-specific Java handler implementation. |
| integration-tests/lambda/snapstart-java/pom.xml | Removed snapstart-specific Java build config. |
| integration-tests/lambda/snapstart-java/.gitignore | Removed snapstart-specific Java ignore rules. |
| integration-tests/lambda/snapstart-dotnet/Function.csproj | Removed snapstart-specific .NET build config. |
| integration-tests/lambda/snapstart-dotnet/Function.cs | Removed snapstart-specific .NET handler implementation. |
| integration-tests/lambda/snapstart-dotnet/.gitignore | Removed snapstart-specific .NET ignore rules. |
| integration-tests/lambda/lmi-node/index.js | Removed LMI-specific Node handler (replaced by shared default). |
| integration-tests/lambda/lmi-java/src/main/java/example/Handler.java | Removed LMI-specific Java handler (replaced by shared default). |
| integration-tests/lambda/lmi-dotnet/Function.csproj | Removed LMI-specific .NET build config (replaced by shared default). |
| integration-tests/lambda/lmi-dotnet/Function.cs | Removed LMI-specific .NET handler (replaced by shared default). |
| integration-tests/lambda/default-python/requirements.txt | Added shared Python handler packaging file. |
| integration-tests/lambda/default-python/lambda_function.py | Updated shared Python handler behavior/response. |
| integration-tests/lambda/default-node/package.json | Added shared Node handler package metadata. |
| integration-tests/lambda/default-node/index.js | Added shared Node handler implementation. |
| integration-tests/lambda/default-java/src/main/java/example/Handler.java | Added shared Java handler implementation. |
| integration-tests/lambda/default-java/pom.xml | Updated shared Java build metadata and dependencies. |
| integration-tests/lambda/default-java/.gitignore | Added shared Java ignore rules. |
| integration-tests/lambda/default-dotnet/Function.csproj | Added shared .NET build config. |
| integration-tests/lambda/default-dotnet/Function.cs | Added shared .NET handler implementation. |
| integration-tests/lambda/default-dotnet/.gitignore | Adjusted shared .NET ignore rules. |
| integration-tests/lambda/base-python/lambda_function.py | Removed base-specific Python handler. |
| integration-tests/lambda/base-node/package.json | Removed base-specific Node package metadata. |
| integration-tests/lambda/base-node/index.js | Removed base-specific Node handler. |
| integration-tests/lambda/base-java/src/main/java/example/Handler.java | Removed base-specific Java handler. |
| integration-tests/lambda/base-java/pom.xml | Removed base-specific Java build config. |
| integration-tests/lambda/base-java/.gitignore | Removed base-specific Java ignore rules. |
| integration-tests/lambda/base-dotnet/Function.cs | Removed base-specific .NET handler. |
| integration-tests/config.ts | Added Datadog indexing wait constants (and migrated wait configuration here). |
| integration-tests/bin/app.ts | Updated app to deploy OnDemand stack instead of Base. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Comment on lines
+28
to
+36
| let responsePayload; | ||
| try { | ||
| responsePayload = JSON.parse(new TextDecoder().decode(response.Payload)); | ||
| console.log(`Response payload: ${JSON.stringify(responsePayload)}`); | ||
| } catch (error: any) { | ||
| console.error('Failed to parse response payload:', error.message); | ||
| console.log('Raw payload:', new TextDecoder().decode(response.Payload)); | ||
| throw error; | ||
| } |
Comment on lines
+10
to
+13
| export const ASYNC_DATADOG_INDEXING_WAIT_MS = 90 * 1000; // 90 seconds | ||
|
|
||
| // Extended wait time for tests that need more time (e.g., OTLP tests) | ||
| export const DATADOG_INDEXING_WAIT_5_MIN_MS = 5 * 60 * 1000; // 5 minutes |
Comment on lines
38
to
42
| DD_SERVICE: javaFunctionName, | ||
| AWS_LAMBDA_EXEC_WRAPPER: '/opt/datadog_wrapper', | ||
| DD_TRACE_ENABLED: 'true', | ||
| SLEEP_MS: '10000', | ||
| }, |
Comment on lines
41
to
46
| DD_SERVICE: nodeFunctionName, | ||
| DD_TRACE_ENABLED: 'true', | ||
| DD_LAMBDA_HANDLER: 'index.handler', | ||
| RETURN_REQUEST_ID: 'true', | ||
| }, | ||
| logGroup: createLogGroup(this, nodeFunctionName) |
Comment on lines
72
to
74
| const now = Date.now(); | ||
| const fromTime = now - (2 * 60 * 60 * 1000); // 2 hours ago | ||
| const fromTime = now - (1 * 60 * 60 * 1000); // 1 hours ago | ||
| const toTime = now; |
Comment on lines
5
to
8
| export async function forceColdStart(functionName: string): Promise<void> { | ||
| setTimestampEnvVar(functionName) | ||
| await new Promise(resolve => setTimeout(resolve, 10000)); | ||
| } |
- Rename base stack to on-demand for clearer naming - Create shared lambda handlers (default-*) used by on-demand, lmi, and snapstart stacks - Refactor tests to use describe.each pattern for iterating over runtimes - Add new test utilities (default.ts, invoke.ts) for cleaner test organization - Remove duplicate per-stack lambda code in favor of shared handlers 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Remove unused payload parsing in invoke.ts - Implement SLEEP_MS support in default handlers for trace isolation testing - Remove unused RETURN_REQUEST_ID env var from lmi.ts - Fix missing await in forceColdStart causing race condition - Fix grammar typo in datadog.ts 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
09a6bd7 to
b87f8c6
Compare
Update GitLab CI test suite name to match the stack rename. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Fixes corrupted lockfile that had absolute local paths causing npm ci to fail on Linux CI with fsevents platform error. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
duncanista
approved these changes
Mar 16, 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.
Overview
Summary
basestack toon-demandfor clearer namingdefault-*) used by on-demand, lmi, and snapstart stacksdescribe.eachpattern for iterating over runtimesdefault.ts,invoke.ts) for cleaner test organizationThis refactoring consolidates ~20 duplicate lambda handler files into 4 shared handlers (one per runtime), making the test infrastructure easier to maintain and extend.
Test plan
on-demand.test.ts- all 40 tests passed🤖 Generated with Claude Code