Skip to content

Commit

Permalink
Merge pull request #29 from GSA/update_makefiles
Browse files Browse the repository at this point in the history
Add integration tests to Makefiles
  • Loading branch information
bryanlalexander authored Dec 16, 2019
2 parents 960c647 + 1440b38 commit d3a106a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion handler/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 ./...
Expand Down

0 comments on commit d3a106a

Please sign in to comment.