|
|
|
|
@ -6,9 +6,9 @@ WEBSITE_REPO=github.com/hashicorp/terraform-website
|
|
|
|
|
default: test
|
|
|
|
|
|
|
|
|
|
tools:
|
|
|
|
|
go get -u github.com/kardianos/govendor
|
|
|
|
|
go get -u golang.org/x/tools/cmd/stringer
|
|
|
|
|
go get -u golang.org/x/tools/cmd/cover
|
|
|
|
|
GO111MODULE=off go get -u golang.org/x/tools/cmd/stringer
|
|
|
|
|
GO111MODULE=off go get -u golang.org/x/tools/cmd/cover
|
|
|
|
|
GO111MODULE=off go get -u github.com/golang/mock/mockgen
|
|
|
|
|
|
|
|
|
|
# bin generates the releaseable binaries for Terraform
|
|
|
|
|
bin: fmtcheck generate
|
|
|
|
|
@ -17,10 +17,10 @@ bin: fmtcheck generate
|
|
|
|
|
# dev creates binaries for testing Terraform locally. These are put
|
|
|
|
|
# into ./bin/ as well as $GOPATH/bin
|
|
|
|
|
dev: fmtcheck generate
|
|
|
|
|
@TF_DEV=1 sh -c "'$(CURDIR)/scripts/build.sh'"
|
|
|
|
|
go install -mod=vendor .
|
|
|
|
|
|
|
|
|
|
quickdev: generate
|
|
|
|
|
@TF_DEV=1 sh -c "'$(CURDIR)/scripts/build.sh'"
|
|
|
|
|
go install -mod=vendor .
|
|
|
|
|
|
|
|
|
|
# Shorthand for building and installing just one plugin for local testing.
|
|
|
|
|
# Run as (for example): make plugin-dev PLUGIN=provider-aws
|
|
|
|
|
@ -32,34 +32,34 @@ plugin-dev: generate
|
|
|
|
|
# we run this one package at a time here because running the entire suite in
|
|
|
|
|
# one command creates memory usage issues when running in Travis-CI.
|
|
|
|
|
test: fmtcheck generate
|
|
|
|
|
go list $(TEST) | xargs -t -n4 go test $(TESTARGS) -timeout=2m -parallel=4
|
|
|
|
|
go list -mod=vendor $(TEST) | xargs -t -n4 go test $(TESTARGS) -mod=vendor -timeout=2m -parallel=4
|
|
|
|
|
|
|
|
|
|
# testacc runs acceptance tests
|
|
|
|
|
testacc: fmtcheck generate
|
|
|
|
|
@if [ "$(TEST)" = "./..." ]; then \
|
|
|
|
|
echo "ERROR: Set TEST to a specific package. For example,"; \
|
|
|
|
|
echo " make testacc TEST=./builtin/providers/aws"; \
|
|
|
|
|
echo " make testacc TEST=./builtin/providers/test"; \
|
|
|
|
|
exit 1; \
|
|
|
|
|
fi
|
|
|
|
|
TF_ACC=1 go test $(TEST) -v $(TESTARGS) -timeout 120m
|
|
|
|
|
TF_ACC=1 go test $(TEST) -v $(TESTARGS) -mod=vendor -timeout 120m
|
|
|
|
|
|
|
|
|
|
# e2etest runs the end-to-end tests against a generated Terraform binary
|
|
|
|
|
# The TF_ACC here allows network access, but does not require any special
|
|
|
|
|
# credentials since the e2etests use local-only providers such as "null".
|
|
|
|
|
e2etest: generate
|
|
|
|
|
TF_ACC=1 go test -v ./command/e2etest
|
|
|
|
|
TF_ACC=1 go test -mod=vendor -v ./command/e2etest
|
|
|
|
|
|
|
|
|
|
test-compile: fmtcheck generate
|
|
|
|
|
@if [ "$(TEST)" = "./..." ]; then \
|
|
|
|
|
echo "ERROR: Set TEST to a specific package. For example,"; \
|
|
|
|
|
echo " make test-compile TEST=./builtin/providers/aws"; \
|
|
|
|
|
echo " make test-compile TEST=./builtin/providers/test"; \
|
|
|
|
|
exit 1; \
|
|
|
|
|
fi
|
|
|
|
|
go test -c $(TEST) $(TESTARGS)
|
|
|
|
|
go test -mod=vendor -c $(TEST) $(TESTARGS)
|
|
|
|
|
|
|
|
|
|
# testrace runs the race checker
|
|
|
|
|
testrace: fmtcheck generate
|
|
|
|
|
TF_ACC= go test -race $(TEST) $(TESTARGS)
|
|
|
|
|
TF_ACC= go test -mod=vendor -race $(TEST) $(TESTARGS)
|
|
|
|
|
|
|
|
|
|
cover:
|
|
|
|
|
@go tool cover 2>/dev/null; if [ $$? -eq 3 ]; then \
|
|
|
|
|
@ -71,12 +71,14 @@ cover:
|
|
|
|
|
|
|
|
|
|
# generate runs `go generate` to build the dynamically generated
|
|
|
|
|
# source files.
|
|
|
|
|
generate:
|
|
|
|
|
@which stringer > /dev/null; if [ $$? -ne 0 ]; then \
|
|
|
|
|
go get -u golang.org/x/tools/cmd/stringer; \
|
|
|
|
|
fi
|
|
|
|
|
go generate ./...
|
|
|
|
|
@go fmt command/internal_plugin_list.go > /dev/null
|
|
|
|
|
generate: tools
|
|
|
|
|
GOFLAGS=-mod=vendor go generate ./...
|
|
|
|
|
# go fmt doesn't support -mod=vendor but it still wants to populate the
|
|
|
|
|
# module cache with everything in go.mod even though formatting requires
|
|
|
|
|
# no dependencies, and so we're disabling modules mode for this right
|
|
|
|
|
# now until the "go fmt" behavior is rationalized to either support the
|
|
|
|
|
# -mod= argument or _not_ try to install things.
|
|
|
|
|
GO111MODULE=off go fmt command/internal_plugin_list.go > /dev/null
|
|
|
|
|
|
|
|
|
|
fmt:
|
|
|
|
|
gofmt -w $(GOFMT_FILES)
|
|
|
|
|
@ -84,9 +86,6 @@ fmt:
|
|
|
|
|
fmtcheck:
|
|
|
|
|
@sh -c "'$(CURDIR)/scripts/gofmtcheck.sh'"
|
|
|
|
|
|
|
|
|
|
vendor-status:
|
|
|
|
|
@govendor status
|
|
|
|
|
|
|
|
|
|
website:
|
|
|
|
|
ifeq (,$(wildcard $(GOPATH)/src/$(WEBSITE_REPO)))
|
|
|
|
|
echo "$(WEBSITE_REPO) not found in your GOPATH (necessary for layouts and assets), get-ting..."
|
|
|
|
|
|