Skip to content

Commit bc37576

Browse files
authored
test: deprecate aws lambda based integration tests because now we have e2e and the RIE based tests (#826)
* test: retire the AWS-based integration suite (moved to local docker + serverless-e2e-tests) The integration_tests/ AWS suite is retired. Its coverage now lives in two places, each stronger at what it owns: - Behavior: integration_tests_local/ (docker/RIE, GitHub Actions, per PR) is now the behavior oracle — hermetic, contributor-runnable, and strictly stronger than the AWS suite at behavior (its goldens preserve span meta/metrics keys the AWS normalization stripped wholesale). After #821 and #823 it covers every variant the AWS suite pinned, including callback-style handlers, fetch, metrics-only mode, payload capture, and the manual-wrap no-init path. - Real-AWS-only signals: the four variants whose value IS the platform — esm (published layer zip artifact + ESM loader), sync-metrics (direct-API sink to the real intake), http-requests (_X_AMZN_TRACE_ID pass-through + real egress), status-code-500s (real API Gateway) — move to a dedicated integration-tests-residual suite in serverless-e2e-tests, which deploys against published/candidate layer ARNs and keeps the same snapshots and byte-identical normalization pipeline. Deleted here: serverless.yml, the six top-level handlers, all 450 snapshots, and scripts/run_integration_tests.sh (459 files). Kept: input_events/, parse-json.js, and container/ — the local suite references the first two and uses container/ as fixture; a new integration_tests/README.md documents this. CI: the GitLab `integration test` job and its sign/publish `needs` entries are removed (build-layer keeps CI_ENABLE_CONTAINER_IMAGE_BUILDS, which it uses to docker-build the layer). CONTRIBUTING.md now points contributors at the local suite. Release-gate note: the per-pipeline AWS gate on sign/publish goes away. The candidate-layer gate moves to the residual suite in serverless-e2e-tests — manual until the e2e release-gate automation lands (migration roadmap), so release runbooks should trigger it until then. * merge main * docs: clarify AWS integration test deprecation * ci: retry pipeline * test: pin RIE tracer per runtime * ci: retrigger pipeline
1 parent e03ba63 commit bc37576

475 files changed

Lines changed: 160 additions & 32403 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.claude/skills/release-lambda-layer/SKILL.md‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,11 @@ Reference: https://datadoghq.atlassian.net/wiki/spaces/SLS/pages/3375925277
3434
1. Create a branch for the version bump.
3535
2. Run `yarn upgrade dd-trace` (or `yarn upgrade dd-trace@^a.b.c` for a
3636
specific version) to pick up the latest tracer.
37-
3. If dd-trace changed, refresh integration test snapshots:
38-
`BUILD_LAYERS=true UPDATE_SNAPSHOTS=true DD_API_KEY=<key from 1Password> aws-vault exec sso-serverless-sandbox-account-admin -- ./scripts/run_integration_tests.sh`
37+
3. If dd-trace changed, refresh the integration test snapshots. The local
38+
RIE-based docker suite is the behavioral gate:
39+
`UPDATE_SNAPSHOTS=true ./integration_tests_local/run.sh`
40+
Rely on the end-to-end test suites for coverage that requires real AWS
41+
Lambda resources.
3942
4. Bump `package.json` version to `X.Y.0`:
4043
- Minor version bumps on every release, and **must match the layer
4144
version**.

‎.gitlab/input_files/build.yaml.tpl‎

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -108,27 +108,6 @@ npm package test ({{ $runtime.name }}):
108108
script:
109109
- ./scripts/test_npm_package.sh datadog-lambda-js-*.tgz
110110

111-
integration test ({{ $runtime.name }}):
112-
stage: test
113-
# `docker-in-docker:<arch>` routes the job to a runner with a live Docker
114-
# daemon (vs. plain `arch:amd64` which only has the docker CLI). Required by
115-
# the container-image integration tests, which build & push ECR images for
116-
# the `container-{cjs,esm}_node*` functions.
117-
tags: ["docker-in-docker:amd64"]
118-
image: ${CI_DOCKER_TARGET_IMAGE}:${CI_DOCKER_TARGET_VERSION}
119-
needs:
120-
- build layer ({{ $runtime.name }})
121-
dependencies:
122-
- build layer ({{ $runtime.name }})
123-
cache: &{{ $runtime.name }}-cache
124-
variables:
125-
CI_ENABLE_CONTAINER_IMAGE_BUILDS: "true"
126-
before_script:
127-
- EXTERNAL_ID_NAME=integration-test-externalid ROLE_TO_ASSUME=sandbox-integration-test-deployer AWS_ACCOUNT=425362996713 source .gitlab/scripts/get_secrets.sh
128-
- (cd integration_tests && yarn install)
129-
script:
130-
- RUNTIME_PARAM={{ $runtime.node_major_version }} ./scripts/run_integration_tests.sh
131-
132111
{{ range $environment := (ds "environments").environments }}
133112
{{ $dotenv := print $runtime.name "_" $environment.name ".env" }}
134113

@@ -146,7 +125,6 @@ sign layer ({{ $runtime.name }}):
146125
- lint ({{ $runtime.name }})
147126
- unit test ({{ $runtime.name }})
148127
- npm package test ({{ $runtime.name }})
149-
- integration test ({{ $runtime.name }})
150128
dependencies:
151129
- build layer ({{ $runtime.name }})
152130
artifacts: # Re specify artifacts so the modified signed file is passed
@@ -182,7 +160,6 @@ publish layer {{ $environment.name }} ({{ $runtime.name }}):
182160
- lint ({{ $runtime.name }})
183161
- unit test ({{ $runtime.name }})
184162
- npm package test ({{ $runtime.name }})
185-
- integration test ({{ $runtime.name }})
186163
{{ end }}
187164
dependencies:
188165
{{ if or (eq $environment.name "prod") }}

‎.pre-commit-config.yaml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ repos:
55
- id: check-merge-conflict
66
files: \.py$
77
- id: trailing-whitespace
8-
exclude: integration_tests/snapshots
8+
exclude: integration_tests_local/snapshots
99
- repo: git@github.com:pre-commit/mirrors-prettier
1010
rev: ""
1111
hooks:
@@ -18,4 +18,4 @@ repos:
1818
description: Checks for AWS or Datadog API keys
1919
entry: .github/.git-hooks/detect-api-keys.py
2020
language: python
21-
exclude: ^(yarn.lock|integration_tests/|event_samples/|src/trace/trigger.spec.ts|src/trace/context.spec.ts|src/trace/trigger.ts)
21+
exclude: ^(yarn.lock|integration_tests/|integration_tests_local/snapshots/|event_samples/|src/trace/trigger.spec.ts|src/trace/context.spec.ts|src/trace/trigger.ts)

‎CONTRIBUTING.md‎

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,19 +34,13 @@ We love pull requests. For new features, consider opening an issue to discuss th
3434
```bash
3535
yarn test
3636
```
37-
1. Run the integration tests against your own AWS account and Datadog org (or ask a Datadog member to run):
37+
1. Run the local docker-based integration tests (no AWS account needed — this is the
38+
behavioral gate that runs per PR):
3839
```bash
39-
BUILD_LAYERS=true DD_API_KEY=<your Datadog api key> ./scripts/run_integration_tests.sh
40+
./integration_tests_local/run.sh
4041
```
41-
1. Update integration test snapshots if needed (Datadog employees only; requires AWS credentials and Docker):
42-
```bash
43-
BUILD_LAYERS=true UPDATE_SNAPSHOTS=true DD_API_KEY=<your Datadog api key> aws-vault exec sso-serverless-sandbox-account-admin -- ./scripts/run_integration_tests.sh
44-
```
45-
If ECR image push fails locally, update zip/layer handler snapshots only:
46-
```bash
47-
BUILD_LAYERS=true UPDATE_SNAPSHOTS=true SKIP_CONTAINER_TESTS=true DD_API_KEY=<your Datadog api key> aws-vault exec sso-serverless-sandbox-account-admin -- ./scripts/run_integration_tests.sh
48-
```
49-
The script uses Serverless `3.39.0` from `integration_tests/package.json` (not a globally installed CLI).
42+
1. Rely on the end-to-end test suites for cases that require real AWS Lambda
43+
resources. See `integration_tests/README.md`.
5044
1. Push to your fork and [submit a pull request][pr].
5145

5246
[pr]: https://github.com/your-username/datadog-lambda-js/compare/DataDog:main..main.

‎integration_tests/README.md‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# integration_tests/
2+
3+
This directory now hosts only the **fixtures shared with the local docker-based
4+
integration suite** (`integration_tests_local/`):
5+
6+
- `input_events/` — the nine event payloads the local RIE-based suite invokes
7+
with,
8+
- `parse-json.js` — JSON-log line parser used by `integration_tests_local/normalize.sh`,
9+
- `container/` — the container-image fixtures (`cjs`, `esm`) built by the local suite.
10+
11+
## The real AWS Lambda resource-based suite was deprecated
12+
13+
The serverless-deployed suite that used to live here (`serverless.yml`,
14+
`snapshots/`, per-handler files, `scripts/run_integration_tests.sh`) was removed.
15+
The in-repo integration coverage now uses `integration_tests_local/`, a
16+
docker/RIE-based suite that runs per PR without an AWS account. Its goldens are
17+
strictly stronger for behavior: they preserve span `meta`/`metrics` keys, which
18+
the deprecated suite's normalization stripped wholesale.
19+
20+
Cases that require real AWS Lambda resources are covered by the end-to-end test
21+
suites.
22+
23+
Do not re-add serverless-deployed tests here. Add behavioral cases to the local
24+
RIE-based suite, and rely on the end-to-end suites for real AWS Lambda resource
25+
cases.

‎integration_tests/container/cjs/Dockerfile‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
ARG NODE_VERSION=22
22
FROM public.ecr.aws/lambda/nodejs:${NODE_VERSION}
33

4-
# Overrides the dd-trace pin in package.json so this image tracks the same
5-
# tracer line as the layer built for NODE_VERSION (v5 below Node 22, v6 above).
6-
ARG DD_TRACE_VERSION=""
4+
# Exact lockfile-resolved v6 pin, or the maintained v5 compatibility pin for
5+
# Node 18/20. The runner always supplies it.
6+
ARG DD_TRACE_VERSION
77

88
# handler.js is the default redirect-mode fixture (DD_LAMBDA_HANDLER=handler.handle).
99
# The remaining *.js files are the manual-wrap fixture handlers ported from the
@@ -12,7 +12,8 @@ ARG DD_TRACE_VERSION=""
1212
COPY package.json *.js ${LAMBDA_TASK_ROOT}/
1313
COPY datadog-lambda-js-local.tgz /tmp/datadog-lambda-js-local.tgz
1414
RUN cd ${LAMBDA_TASK_ROOT} \
15-
&& if [ -n "$DD_TRACE_VERSION" ]; then npm pkg set dependencies.dd-trace="$DD_TRACE_VERSION"; fi \
15+
&& test -n "$DD_TRACE_VERSION" \
16+
&& npm pkg set dependencies.dd-trace="$DD_TRACE_VERSION" \
1617
&& npm install --omit=dev \
1718
&& npm install --no-save /tmp/datadog-lambda-js-local.tgz \
1819
&& rm /tmp/datadog-lambda-js-local.tgz

‎integration_tests/container/cjs/package.json‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
"version": "1.0.0",
44
"private": true,
55
"dependencies": {
6-
"axios": "1.18.1",
7-
"dd-trace": "6.15.0"
6+
"axios": "1.18.1"
87
}
98
}

‎integration_tests/container/esm/Dockerfile‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
ARG NODE_VERSION=22
22
FROM public.ecr.aws/lambda/nodejs:${NODE_VERSION}
33

4-
# Overrides the dd-trace pin in package.json so this image tracks the same
5-
# tracer line as the layer built for NODE_VERSION (v5 below Node 22, v6 above).
6-
ARG DD_TRACE_VERSION=""
4+
# Exact lockfile-resolved v6 pin, or the maintained v5 compatibility pin for
5+
# Node 18/20. The runner always supplies it.
6+
ARG DD_TRACE_VERSION
77

88
COPY package.json handler.mjs ${LAMBDA_TASK_ROOT}/
99
COPY datadog-lambda-js-local.tgz /tmp/datadog-lambda-js-local.tgz
1010
RUN cd ${LAMBDA_TASK_ROOT} \
11-
&& if [ -n "$DD_TRACE_VERSION" ]; then npm pkg set dependencies.dd-trace="$DD_TRACE_VERSION"; fi \
11+
&& test -n "$DD_TRACE_VERSION" \
12+
&& npm pkg set dependencies.dd-trace="$DD_TRACE_VERSION" \
1213
&& npm install --omit=dev \
1314
&& npm install --no-save /tmp/datadog-lambda-js-local.tgz \
1415
&& rm /tmp/datadog-lambda-js-local.tgz

‎integration_tests/container/esm/package.json‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,5 @@
33
"version": "1.0.0",
44
"private": true,
55
"type": "module",
6-
"dependencies": {
7-
"dd-trace": "6.15.0"
8-
}
6+
"dependencies": {}
97
}

‎integration_tests/container/layer/Dockerfile‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,21 @@
1111
ARG NODE_VERSION=22
1212
FROM public.ecr.aws/lambda/nodejs:${NODE_VERSION}
1313

14+
# Exact lockfile-resolved v6 pin, or the maintained v5 compatibility pin for
15+
# Node 18/20. The runner always supplies it.
16+
ARG DD_TRACE_VERSION
17+
1418
# Install dependencies BEFORE copying layer_pkg: npm prunes anything in
1519
# node_modules that is not in deps.package.json, so copying the layer tree
1620
# first would silently delete it.
1721
COPY deps.package.json /opt/nodejs/package.json
1822
# --omit=optional matches the release build's --ignore-optional: pprof/appsec
1923
# natives are not exercised by these fixtures and skipping them keeps the
2024
# build fast.
21-
RUN cd /opt/nodejs && npm install --omit=dev --omit=optional --no-audit --no-fund
25+
RUN cd /opt/nodejs \
26+
&& test -n "$DD_TRACE_VERSION" \
27+
&& npm pkg set dependencies.dd-trace="$DD_TRACE_VERSION" \
28+
&& npm install --omit=dev --omit=optional --no-audit --no-fund
2229
COPY layer_pkg /opt/nodejs/node_modules/datadog-lambda-js/
2330

2431
# handler.js (CJS) and esm.mjs (top-level await) are plain unwrapped user

0 commit comments

Comments
 (0)