This project uses Test Kitchen with Docker to validate our infrastructure and cloudformation. It includes a Makefile for easy command handling and a Dockerfile to create a standardized testing environment.
These environment variables are used for running the tests:
OBSERVE_CUSTOMER
: The Observe customerOBSERVE_TOKEN
: The Observe tokenOBSERVE_DOMAIN
: The Observe environment domain (default: observe-eng.com)AWS_ACCESS_KEY_ID
: Your AWS access key IDAWS_SECRET_ACCESS_KEY
: Your AWS secret access keyAWS_SESSION_TOKEN
: Your AWS session token (if required)AWS_REGION
: Your preferred AWS region (default: us-east-1)PROVIDER
:terraform
orcloudformation
(default: cloudformation)
If you want to persist your environment configuration a env.template
file is available
cp env.template .env
vi .env # edit the values
source .env
We're ignoring .env*
so feel free make as many as required ie .env-cloudformation
or .env-accountnumber
etc
- AWS Access (
aws sts get-caller-identity
is your friend ) - A valid observe customer / token / domain
- Docker installed
- Run the tests within a docker container by running
make docker/test
. - To clean up the resources created during the test, run
make docker/test/clean
- To clean up the resources including the docker image / container run
make docker/clean
- AWS Access (
aws sts get-caller-identity
is your friend ) - A valid observe customer / token / domain
- Ensure the dependencies within the
./validate_deps.sh
script are installed by running./validate_deps.sh
. - Install the gems listed within the Gemfile via
bundler install
.
- Run
make test
to validate dependencies, create the kitchen environment and run the verifier. - To clean up the resources created during the test, run
make test/clean
.
Refer to the test kitchen (documentation)[https://kitchen.ci/docs/getting-started/introduction/] but bellow is a brief explanation of some common commands.
Provision the infrastructure
# make test/create
kitchen create
Test the infrastructure agains the spec
# make test/verify
kitchen verify
# the rspec equivalent
rspec -c -f documentation --default-path '/workdir' -P 'test/integration/base/verify/collection_spec.rb'
Teardown the infrastructure
# make test/clean
kitchen destroy