Skip to content

Commit

Permalink
Merge pull request #494 from saschagrunert/test-local
Browse files Browse the repository at this point in the history
Use -mod=vendor for running unit tests
  • Loading branch information
vrothberg authored Dec 12, 2019
2 parents eb75f26 + 640c1f8 commit d8c2568
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,11 @@ BUILDFLAGS := -tags "$(AUTOTAGS) $(TAGS)" $(FLAGS)
GO ?= go

GO_BUILD=$(GO) build
GO_TEST=$(GO) test
# Go module support: set `-mod=vendor` to use the vendored sources
ifeq ($(shell $(GO) help mod >/dev/null 2>&1 && echo true), true)
GO_BUILD=GO111MODULE=on $(GO) build -mod=vendor
GO_TEST=GO111MODULE=on $(GO) test -mod=vendor
endif

RUNINVM := vagrant/runinvm.sh
Expand Down Expand Up @@ -95,7 +97,7 @@ test: local-binary ## build the binaries and run the tests using VMs
$(RUNINVM) make local-binary local-cross local-test-unit local-test-integration

local-test-unit: local-binary ## run the unit tests on the host (requires\nsuperuser privileges)
@$(GO) test $(BUILDFLAGS) $(shell $(GO) list ./... | grep -v ^$(PACKAGE)/vendor)
@$(GO_TEST) $(BUILDFLAGS) $(shell $(GO) list ./... | grep -v ^$(PACKAGE)/vendor)

test-unit: local-binary ## run the unit tests using VMs
$(RUNINVM) make local-$@
Expand Down

0 comments on commit d8c2568

Please sign in to comment.