From cc9629d37f9b7b00dee82125f797afcd56fddb6b Mon Sep 17 00:00:00 2001 From: Jing Xu Date: Fri, 17 Jan 2020 16:22:10 -0800 Subject: [PATCH] Enable unit test enable unit test by uncommenting main in .prow.sh. Add test module in Makefile. Due to the issue related to guid package https://github.com/microsoft/go-winio/pull/169 which causes errors when running unit tests on Linux, the current solution is to add some filter for the test path. Will update it after the issue is resolved. --- .prow.sh | 2 +- Makefile | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.prow.sh b/.prow.sh index e67318f8..b1154301 100755 --- a/.prow.sh +++ b/.prow.sh @@ -9,4 +9,4 @@ # TODO: Once we add windows build rules and a Makefile, we can enable # some basic unit testing -# main +main diff --git a/Makefile b/Makefile index 63316be2..aa4ea9aa 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,7 @@ BUILD_TOOLS_DIR = $(BUILD_DIR)/tools GO_ENV_VARS = GO111MODULE=on GOOS=windows .PHONY: all -all: generate compile lint +all: compile lint .PHONY: compile compile: compile-client compile-server compile-csi-proxy-api-gen @@ -74,6 +74,14 @@ lint: $(GOLANGCI_LINT) $(GO_ENV_VARS) $(GOLANGCI_LINT) run git --no-pager diff --exit-code +.PHONY: test-go +test: test-go +test-go: + @ echo; echo "### $@:" + # TODO: After issue https://github.com/microsoft/go-winio/pull/169 is resolved, remove the filter on the test path. + go test `find ./internal/server/ -type d -not -name server`;\ + go test `go list ./client/apiversion/...` + # see https://github.com/golangci/golangci-lint#binary-release $(GOLANGCI_LINT): curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b "$$(dirname '$(GOLANGCI_LINT)')" '$(GOLANGCI_LINT_VERSION)'