Skip to content

test(batch): add Lambda Managed Instances isolation coverage - #5768

Merged
svozza merged 9 commits into
aws-powertools:mainfrom
karthiksenv:codex/batch-lmi-e2e
Oct 5, 2026
Merged

svozza merged 9 commits into
aws-powertools:mainfrom
karthiksenv:codex/batch-lmi-e2e

Conversation

@karthiksenv

Copy link
Copy Markdown
Contributor

Summary

Add real-platform Batch isolation coverage for Lambda Managed Instances. The suite exercises module-scoped standard SQS and asynchronous FIFO processors with overlapping invocations, checking that record handlers, partial failures, and failed FIFO groups remain scoped to their invocation.

Changes

  • Add standard SQS and FIFO LMI suites with 30 concurrent invocations, a first-record peer barrier, one worker per execution environment, and concurrency set to 10.
  • Check actual callback records and exact failure IDs across healthy, partially failed, and fully failed batches. Reuse FIFO group names across invocations to expose leaked failed-group state.
  • Register Batch in the existing LMI workflow through test:e2e:lmi, keep ordinary E2E runs separate, and increase shared capacity to retain spare instance headroom for the expanded matrix. The two Batch variants deploy and tear down sequentially.
  • Add a local test of the same handlers using the real InvokeStore library. Both variants pass with isolation and fail when isolation is temporarily disabled: standard SQS mixes failure IDs and FIFO skips healthy records.

Validation

  • Workspace build, all workspace test type checks, and staged Biome checks pass.
  • Full unit suite: 3,935 tests pass; statements, branches, functions, and lines all have 100% coverage. Run with npx vitest --run --maxWorkers=4 --testTimeout=30000 --exclude tests/unit/layer-publisher.test.ts --coverage --coverage.thresholds.100 tests/unit. The existing CDK stack-tagging test exceeds its default five-second timeout on this Windows machine; the longer timeout is a local command-line setting only.
  • Both handlers bundle, and CDK synthesis passes with shared and ephemeral capacity providers; checked concurrency, worker count, scaling, and publication configuration.
  • Real AWS execution is pending: this environment has no AWS credentials. A maintainer needs to run the existing E2E workflow on this branch to validate Node.js 22/24 and x86_64/arm64 on Lambda Managed Instances before merge.

Issue number: closes #5684


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.

Comment thread packages/batch/tests/e2e/lmi.test.functionCode.ts Outdated
Comment thread packages/batch/tests/e2e/lmi.test.functionCode.ts Outdated
Comment thread packages/batch/tests/helpers/lmi.ts Outdated
@svozza

svozza commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

Thanks for this! Can you reply to the issue this PR closes so I can assign it to you?

@karthiksenv

Copy link
Copy Markdown
Contributor Author

Thanks! I've commented on #5684 so you can assign it to me.

Comment thread packages/batch/tests/unit/concurrency/lmiHandler.test.ts Outdated
Comment thread packages/batch/tests/unit/concurrency/BatchProcessor.test.ts Outdated
@svozza
svozza merged commit 533248a into aws-powertools:main Oct 5, 2026
41 checks passed
@svozza

svozza commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

Thank you for your work here, great to have LMI test coverage of this utility. Merged!

@powertools-for-aws-oss-automation

Copy link
Copy Markdown

Awesome work, congrats on your first merged pull request and thank you for helping improve everyone's experience!

@karthiksenv

Copy link
Copy Markdown
Contributor Author

Thanks, @svozza! I appreciate the careful reviews and the help getting the tests into shape. Glad to have the Batch LMI coverage merged, and happy to make my first contribution here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/L PRs between 100-499 LOC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Maintenance: Add Batch E2E tests for Lambda Managed Instances

2 participants