Browse the Repo

file-type-icon.circleci
file-type-iconexamples
file-type-iconmodules
file-type-icontest
file-type-iconREADME.md
file-type-icongo.mod
file-type-icongo.sum
file-type-icongruntwork-logo.base64.txt
file-type-iconhelpers_test.go
file-type-iconlambda_build_test.go
file-type-iconlambda_dead_letter_queue_test.go
file-type-iconlambda_edge_test.go
file-type-iconlambda_keep_warm_test.go
file-type-iconlambda_s3_deployment_package_test.go
file-type-iconlambda_s3_reserved_test.go
file-type-iconlambda_s3_test.go
file-type-iconlambda_vpc_test.go
file-type-iconscheduled_lambda_job_test.go
file-type-icon.gitignore
file-type-icon.pre-commit-config.yaml
file-type-iconCODEOWNERS
file-type-iconLICENSE.txt
file-type-iconREADME.md
file-type-iconowners.txt
file-type-iconterraform-cloud-enterprise-private-module-...

Browse the Repo

file-type-icon.circleci
file-type-iconexamples
file-type-iconmodules
file-type-icontest
file-type-iconREADME.md
file-type-icongo.mod
file-type-icongo.sum
file-type-icongruntwork-logo.base64.txt
file-type-iconhelpers_test.go
file-type-iconlambda_build_test.go
file-type-iconlambda_dead_letter_queue_test.go
file-type-iconlambda_edge_test.go
file-type-iconlambda_keep_warm_test.go
file-type-iconlambda_s3_deployment_package_test.go
file-type-iconlambda_s3_reserved_test.go
file-type-iconlambda_s3_test.go
file-type-iconlambda_vpc_test.go
file-type-iconscheduled_lambda_job_test.go
file-type-icon.gitignore
file-type-icon.pre-commit-config.yaml
file-type-iconCODEOWNERS
file-type-iconLICENSE.txt
file-type-iconREADME.md
file-type-iconowners.txt
file-type-iconterraform-cloud-enterprise-private-module-...
AWS Lambda

AWS Lambda

Deploy Lambda functions with Terraform. Supports uploading deployment packages, configuring environment variables, and scheduled functions.

Code Preview

Preview the Code

mobile file icon

README.md

down

Tests

This folder contains the tests for the modules in this repo.

Running the tests locally

Note #1: Many of these tests create real resources in an AWS account. That means they cost money to run, especially if you don't clean up after yourself. Please be considerate of the resources you create and take extra care to clean everything up when you're done!

Note #2: Never hit CTRL + C or cancel a build once tests are running or the cleanup tasks won't run!

Note #3: We set -timeout 45m on all tests not because they necessarily take 45 minutes, but because Go has a default test timeout of 10 minutes, after which it does a SIGQUIT, preventing the tests from properly cleaning up after themselves. Therefore, we set a timeout of 45 minutes to make sure all tests have enough time to finish and cleanup.

Prerequisites

  • Install the latest version of Go.
  • Install dep for Go dependency management. On OSX, the simplest way to install is brew update; brew install dep.
  • Install Terraform.
  • Add your AWS credentials as environment variables: AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY
  • For some of the tests, you also need to set the GITHUB_OAUTH_TOKEN environment variable to a valid GitHub auth token with "repo" access. You can generate one here: https://github.com/settings/tokens

Setup

Download Go dependencies using dep:

cd test
dep ensure

Run all the tests

cd test
go test -v -timeout 45m -parallel 128

Run a specific test

To run a specific test called TestFoo:

cd test
go test -v -timeout 45m -parallel 128 -run TestFoo

Questions? Ask away.

We're here to talk about our services, answer any questions, give advice, or just to chat.

Ready to hand off the Gruntwork?