Skip to content

chore: add e2e lifecycle test and workflow#710

Draft
ava-silver wants to merge 1 commit into
ava.silver/chore/add-e2e-lambda-fixturefrom
ava.silver/chore/add-e2e-lifecycle-test-and-workflow
Draft

chore: add e2e lifecycle test and workflow#710
ava-silver wants to merge 1 commit into
ava.silver/chore/add-e2e-lambda-fixturefrom
ava.silver/chore/add-e2e-lifecycle-test-and-workflow

Conversation

@ava-silver

@ava-silver ava-silver commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds the end-to-end instrumentation lifecycle test for serverless-plugin-datadog on AWS Lambda, plus its harness, README, and CI workflow. lambda.test.ts drives a Serverless Framework fixture through the full contract:

  1. APPLY -- sls deploy; the plugin instruments the function. Assert config present (pinned Datadog Node + extension layers, redirected handler, DD_* env, identifying tags).
  2. TRIGGER -- lambda invoke, then poll the Datadog API until spans and logs carrying the run identity (service/env/version/run id) appear.
  3. RE-APPLY -- redeploy; assert the function config is byte-for-byte unchanged (no diff, no double-wrap or duplicated layers).
  4. REMOVE -- sls remove; assert the function no longer exists.

Provision and APPLY coincide here -- the plugin runs as part of sls deploy, so there's no separate uninstrumented baseline. helpers/e2e.config.ts holds the repo-specific bits: naming, retry patterns, expected layer ARNs read from the plugin's own src/layers.json, and the verifier contract.

Infrastructure

The "tool under test" is the plugin itself, built from src and npm pack'd into a tarball that's installed into the fixture -- not a published release -- so a failure blames the plugin.

flowchart LR
  src["serverless-plugin-datadog<br/>(src, under test)"]
  tarball["npm pack tarball"]
  fixture["sls fixture<br/>(serverless.yml + handler)"]
  ddAcct["Public DD layer account"]
  fn["Workload Lambda"]

  src -->|build + pack| tarball
  tarball -->|installed into| fixture
  fixture -->|sls deploy: APPLY instruments| fn
  ddAcct -->|Node + Extension layers| fn
Loading

setup.sh packs and installs the plugin via a tarball rather than an npm file: dep, which would recurse (the fixture lives under the repo root). The Datadog API key is passed inline through serverless.yml and surfaces as DD_API_KEY on the function; CI mints it so the workload ships to the org the suite queries. sls deploy provisions the function through a CloudFormation stack; REMOVE/teardown is sls remove, always.

Motivation

Gives the plugin a real instrumentation lifecycle test against live AWS + Datadog, so a regression in layer pinning, handler redirect, env wiring, or telemetry flow fails CI.

Testing Guidelines

.github/workflows/e2e.yml runs the suite behind src/** + e2e/** path filters. AWS creds come from OIDC, Datadog creds from dd-sts -- no long-lived secrets, and a missing credential fails loudly rather than skipping green.

Ran the full suite end-to-end locally against the serverless sandbox -- all phases plus teardown pass.

Additional Notes

Layer/extension versions and the runtime are pinned (src/layers.json, overridable via env) so failures blame the plugin, not an upstream bump. frameworkVersion is pinned to 3 to avoid the Serverless v4 login flow in CI.

Types of changes

  • Bug fix
  • New feature
  • Breaking change
  • Misc (docs, refactoring, dependency upgrade, etc.)

Check all that apply

  • This PR's description is comprehensive
  • This PR contains breaking changes that are documented in the description
  • This PR introduces new APIs or parameters that are documented and unlikely to change in the foreseeable future
  • This PR impacts documentation, and it has been updated (or a ticket has been logged)
  • This PR's changes are covered by the automated tests
  • This PR collects user input/sensitive content into Datadog

Copy link
Copy Markdown
Contributor Author

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@ava-silver ava-silver mentioned this pull request Jun 26, 2026
10 tasks
@codecov-commenter

codecov-commenter commented Jun 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.69%. Comparing base (0c280ce) to head (d8d9b06).

Additional details and impacted files
@@                           Coverage Diff                            @@
##           ava.silver/chore/add-e2e-lambda-fixture     #710   +/-   ##
========================================================================
  Coverage                                    77.69%   77.69%           
========================================================================
  Files                                           12       12           
  Lines                                         1112     1112           
  Branches                                       350      350           
========================================================================
  Hits                                           864      864           
  Misses                                         118      118           
  Partials                                       130      130           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@datadog-prod-us1-3

datadog-prod-us1-3 Bot commented Jun 26, 2026

Copy link
Copy Markdown

Pipelines

Fix all issues with BitsAI

⚠️ Warnings

🚦 1 Pipeline job failed

e2e | Lambda e2e (Node 20)   View in Datadog   GitHub Actions

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: d8d9b06 | Docs | Datadog PR Page | Give us feedback!

@ava-silver ava-silver force-pushed the ava.silver/chore/add-e2e-lifecycle-test-and-workflow branch from aa00789 to 09bfcd7 Compare June 26, 2026 21:36
@ava-silver ava-silver force-pushed the ava.silver/chore/add-e2e-lambda-fixture branch from 7488413 to 26daf29 Compare June 26, 2026 21:36
@ava-silver ava-silver force-pushed the ava.silver/chore/add-e2e-lifecycle-test-and-workflow branch from 09bfcd7 to d8d9b06 Compare June 29, 2026 17:35
@ava-silver ava-silver force-pushed the ava.silver/chore/add-e2e-lambda-fixture branch from 26daf29 to 0c280ce Compare June 29, 2026 17:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants