aws-lambda-powershell-runtime icon indicating copy to clipboard operation
aws-lambda-powershell-runtime copied to clipboard

Scenario testing (synthetic deployments into Lambda)

Open sean-r-williams opened this issue 7 months ago • 2 comments

I'm excited to see unit tests being added here. Given a lot of this runtime's functionality is based on Lambda itself, it would be great if we could get programmatically test runtime features directly within Lambda.

I'm envisioning some Pester tests that:

  • Build the runtime layer (maybe in a BeforeAll{} block - I think we already have tests for the layer-build script?)
  • Iterate over a set of SAM templates (or multiple instantiations of a parameterized template) that:
    • Refer to the runtime layer
    • Deploy a "hello world"-type handler
    • Invoke the lambda, once the deployment finishes
    • Assert that the lambda runs
  • Tear down SAM stacks when done

If we're trying to test specific features (e.g. compressed module handling, I would expect that one of the "test cases" (i.e. instantiations of the SAM template) deploys a Lambda that uses said feature.

I know GHA has a relatively straightforward integration story with AWS IAM - I envision GHA fetching AWS creds before running tests, whereas people testing locally would be able to use whatever AWS CLI creds they have configured.

sean-r-williams avatar Jul 18 '25 18:07 sean-r-williams

Hey @sean-r-williams - see https://github.com/awslabs/aws-lambda-powershell-runtime/pull/46!

It adds integration tests to validate invocations of the runtime within Lambda, although they will need to be manually invoked for now.

austoonz avatar Jul 18 '25 19:07 austoonz

These additions were required to help us safely add functionality, such as solving the features you've requested such as #37 and #40 .

austoonz avatar Jul 18 '25 19:07 austoonz