chore: add Lambda e2e integration test suite#619
Closed
ava-silver wants to merge 15 commits into
Closed
Conversation
This comment has been minimized.
This comment has been minimized.
…unId at call site
ava-silver
force-pushed
the
ava.silver/chore/lambda-e2e-suite
branch
from
June 26, 2026 20:56
ca902f6 to
a186edd
Compare
Contributor
Author
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.

What does this PR do?
Adds a full-lifecycle end-to-end test suite for the
DatadogLambdaconstruct that runs a realcdk deployagainst AWS and verifies telemetry actually reaches Datadog. It conforms to the serverless instrumentation e2e contract (serverless-ci/e2e/spec.md) and is distinct from the existing synth-only snapshot integration tests.The construct is the instrumentation mechanism, so APPLY and REMOVE are both
cdk deployof the same stack (e2e/app/app.ts); onlyE2E_INSTRUMENTdiffers:E2E_INSTRUMENT=false), uniquely namedone-e2e-cdk-lambda-<runid>and freshness-tagged at creation.E2E_INSTRUMENT=true) -- verify config: pinned Datadog Node + Extension layers, handler redirected to the Datadog wrapper, and the requiredDD_*env vars asserted by identity (DD_SERVICE,DD_ENV,DD_VERSION,DD_SITE,DD_API_KEY,DD_TRACE_ENABLED,DD_LOGS_INJECTION, run id inDD_TAGS).aws lambda invoke) -- poll Datadog spans + logs filtered by run id and assert each carries the expectedservice/env/version/run id (identity, not mere existence).cdk diff --failasserts no diff (idempotent).DD_*env vars, and thedd_cdk_constructtag are gone. The hygiene freshness tag intentionally survives so the cross-repo sweeper can still reap the function.Teardown (
cdk destroy) always runs, even on failure.Motivation
The repo had no test that exercised the construct against real AWS and confirmed telemetry lands in Datadog -- only synth-time snapshot checks. This suite closes that gap end-to-end and plugs the construct into the shared serverless e2e contract.
Testing Guidelines
The
lambda-e2ejob runs the full lifecycle in CI (deploy + config verify + spans/logs telemetry identity + idempotent re-apply + remove/clean verify + teardown). It is path-filtered to construct or suite changes and self-skips (no-op) viaSKIP_LAMBDA_TESTSwhen nothing relevant changed; forks no-op because OIDC only exists on the canonical repo. When it does run, the AWS OIDC / dd-sts steps must succeed -- an auth or telemetry failure fails the job loudly.Local run (prerequisites and commands in
e2e/README.md):Additional Notes
gha-datadog-cdk-e2erole in the serverless sandbox account, scoped to deployone-e2e-cdk-lambda-*through the CDK bootstrap roles. Datadog API + App keys are minted at runtime viaDataDog/dd-sts-actionunder thedatadog-cdk-constructs-e2epolicy (GitHub OIDC -> short-lived keys) -- no static Datadog keys live in this repo. IAM resources are cataloged inserverless-ci/e2e/iam-infra.md.AWS_ROLE_ARN_E2E,AWS_REGION_E2E,DD_SITE_E2E,SKIP_LAMBDA_TESTS.srcwith esbuild (the repo TS 6 toolchain is incompatible with ts-node), so the suite exercises the construct code in this repo, not a published package.e2e/helpers/versions.ts(Node 22 runtime, Node layer + Extension layer); bump deliberately so a failure blames this construct's wiring, not an upstream layer/tracer change.node:assert, no jest/vitest imports) per the spec, so other suites can reuse them..projenrc.js(not direct edits to generated files):vitest+@datadog/datadog-api-clientdevDeps and atest:e2etask.one-e2e-cdk-lambda-<runid>and taggedone_e2e_created:<unix-ts>; in-test teardown is best-effort and the cross-repo sweeper is the real guarantee.Types of Changes
Check all that apply