Skip to content

Latest commit

 

History

History

Automated tests

This folder contains the automated tests for all of the example code in the /examples folder.

Note: This repo is for demonstration and learning purposes only and should NOT be used to run anything important. For production-ready versions of this code and many other types of infrastructure, check out Gruntwork.

Running automated tests for the Terraform examples

WARNING: The Terraform modules and their automated tests deploy real resources into your AWS account which can cost you money. The resources are all part of the AWS Free Tier, so if you haven't used that up, it should be free, but you are completely responsible for all AWS charges.

  1. Sign up for AWS.
  2. Configure your AWS credentials using one of the supported methods for AWS CLI tools, such as setting the AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables.
  3. Install Terraform and make sure it's on your PATH.
  4. Install Golang, minimum version 1.13.
  5. cd test
  6. To run a single test: go test -v -timeout 15m -run <TEST_NAME>

Running automated tests for the Docker and Kubernetes examples

  1. Install Docker.
  2. Install Golang, minimum version 1.13.
  3. You'll need access to a Kubernetes cluster to run these tests. Recommended option: If you're using the Docker Desktop app, then you already have a local Kubernetes cluster installed! Alternatively, you can run Kubernetes locally using MiniKube or run these tests against a Kubernetes cluster in the cloud, such as Amazon EKS, Google Container Engine, or Azure Kubernetes Service.
  4. Whichever option you choose to run your Kubernetes cluster, you'll need to authentiate to it. If you're running Kubernetes locally (e.g., via Docker for Desktop), you're probably already authenticated to it, so there's nothing to do.
  5. cd test
  6. To run a single test: go test -v -timeout 15m -run <TEST_NAME>