Aws-sam-cli: Run tests in an environment which also includes layers

Created on 29 Dec 2018  路  1Comment  路  Source: aws/aws-sam-cli

Describe your idea/feature/enhancement

AWS Lambda Layers now make it possible to package a collection of dependencies together and can be shared across multiple Lambda Functions. AWS Lambda Layers can include language specific libraries, which the function will import to use.

This can break unit-tests written for Lambda Functions, as there may be imports that are provided via a Lambda Layer instead of via a build manifest (e.g. requirements.txt).

Therefore, we need a way to execute unit-tests within the same environment as when you run sam local invoke.

This problem also exists for other CI related checks like linting.

Additional Details

When you run unit-tests, linters etc, these may depend on additional build dependencies that you only need when running the checks but don't want in the final deploy, for example py.test. This would require some way of providing additional dependencies to the docker container that is used when running the checks.

arelayers stagbug-repro typfeature

Most helpful comment

It seems like some packagers provide a native way of specifying "dev" dependencies, for example pipenv and npm.

Perhaps we could add a new command sam dev build which would install the dev dependencies, and sam dev run to run commands under this environment which would also include layers.

>All comments

It seems like some packagers provide a native way of specifying "dev" dependencies, for example pipenv and npm.

Perhaps we could add a new command sam dev build which would install the dev dependencies, and sam dev run to run commands under this environment which would also include layers.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

zhangzhx picture zhangzhx  路  3Comments

dschu-lab picture dschu-lab  路  3Comments

chestongo picture chestongo  路  3Comments

terlar picture terlar  路  3Comments

Caian picture Caian  路  3Comments