PRs are welcome!
The following sections will include the required steps to develop and run tests for this project.
The project contains unit, integration, and e2e tests that are within the tests/
directory. Each of the tests uses the Pytest framework.
NOTE: All Terraform resources will automatically be deleted during the PyTest session cleanup. If the provisioned resources are needed after the PyTest execution,
use the `--skip-tf-destroy` flag (e.g. `pytest tests/e2e --skip-tf-destroy`). BEWARE: If the resources are left alive after the tests, the AWS account may incur additional charges.
The following tools are required:
- Clone this repo by running the CLI command:
git clone https://github.com/marshall7m/terraform-aws-infrastructure-live-ci.git
- Within your CLI, change directories to root of the repo
- Ensure that the environment variables from the
./.devcontainer/docker-compose.yml
file'senvironment:
section are set. For a description of theTF_VAR_*
variables, see thetests/unit/variables.tf
andtests/e2e/variables.tf
files.
Once you complete the above steps, you can choose from the following sections depending on your preference
The following additional tools are required:
To launch a full-fledged development docker container that includes all the dependencies needed for this project, see this section's instructions.
To just run the tests, the docker compose plugin can be used to launch the dev
service within the .devcontainer/docker-compose.yml
file with the associated testing command.
The following additional tools are required:
To execute the tests from the repo's root directory, run commands like so:
-
docker compose -f ./.devcontainer/docker-compose.yml run --rm dev pytest tests/unit
-
docker compose -f ./.devcontainer/docker-compose.yml run --rm dev pytest tests/integration
All the containers that the dev
service depends on will be launched within the same custom docker bridge network.
The steps below will run the GitHub Actions workflow via act within local Docker containers.
The following additional tools are required:
- Run the following command:
act push
. This will run the GitHub workflow logic for push events - A prompt will arise requesting GitHub Action secrets needed to run the workflow. Fill in the secrets accordingly. The secrets can be set via environment variables to skip the prompt. For a description of the
TF_VAR_*
variables, see the unit testing variables.tf and e2e testing variables.tf file.
NOTE: All Terraform resources will automatically be deleted during the PyTest session cleanup