From 1440b38c48c8a5c12ab1538686784e18db4566c1 Mon Sep 17 00:00:00 2001 From: Brian Fitzwater - IDI-C Date: Mon, 16 Dec 2019 09:02:39 -0500 Subject: [PATCH] Add integration tests to Makefiles --- .circleci/config.yml | 2 +- Makefile | 5 ++++- handler/Makefile | 5 ++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 58662ec..54cfa5c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -21,7 +21,7 @@ jobs: command: if [[ -n "$(terraform fmt -write=false)" ]]; then echo "Some terraform files need be formatted, run 'terraform fmt' to fix"; exit 1; fi - run: name: Install tflint - command: curl -L -o /tmp/tflint.zip https://github.com/wata727/tflint/releases/download/v0.13.2/tflint_linux_amd64.zip && unzip /tmp/tflint.zip -d /usr/local/bin + command: curl -L -o /tmp/tflint.zip https://github.com/terraform-linters/tflint/releases/download/v0.13.2/tflint_linux_amd64.zip && unzip /tmp/tflint.zip -d /usr/local/bin - run: name: Check Terraform configurations with tflint command: find . -name ".terraform" -prune -o -type f -name "*.tf" -exec dirname {} \;|sort -u | while read m; do (cd "$m" && tflint && echo "√ $m") || exit 1 ; done diff --git a/Makefile b/Makefile index b9b8b83..f7f5165 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,7 @@ endif export appenv := $(shell echo "$(environment)" | tr '[:upper:]' '[:lower:]') export TF_VAR_appenv := $(appenv) -.PHONY: test deploy check lint_handler test_handler build_handler release_handler plan_terraform validate_terraform init_terraform apply_terraform apply_terraform_tests destroy_terraform_tests clean +.PHONY: test deploy check lint_handler test_handler build_handler release_handler integration_test plan_terraform validate_terraform init_terraform apply_terraform apply_terraform_tests destroy_terraform_tests clean test: test_handler plan_terraform deploy: build_handler apply_terraform @@ -42,6 +42,9 @@ build_handler: release_handler: make -C handler release +integration_test: + make -C handler integration_test + plan_terraform: validate_terraform terraform plan make -C tests plan diff --git a/handler/Makefile b/handler/Makefile index 059c3fa..b39a073 100644 --- a/handler/Makefile +++ b/handler/Makefile @@ -8,7 +8,7 @@ RELEASEDIR ?= ../release/ CIRCLE_PROJECT_REPONAME ?= grace-inventory-lambda export GO111MODULE=on -.PHONY: build release clean test lint dependencies +.PHONY: build release clean test lint dependencies integration_test build: lint clean mkdir -p $(RELEASEDIR) GOOS=$(GOOS) GOARCH=$(GOARCH) go build -o $(RELEASEDIR)$(CIRCLE_PROJECT_REPONAME) -v @@ -33,6 +33,9 @@ clean: test: lint go test -v -cover ./... +integration_test: test + go test -v -cover --tags=integration ./... + lint: go.mod dependencies go mod tidy golangci-lint run ./...