Skip to content

Commit 6ad5c23

Browse files
committed
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 microsoft/go-winio#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.
1 parent 2eb1ac1 commit 6ad5c23

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

.prow.sh

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,4 @@
77

88
. release-tools/prow.sh
99

10-
# TODO: Once we add windows build rules and a Makefile, we can enable
11-
# some basic unit testing
12-
# main
10+
main

Makefile

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@ BUILD_TOOLS_DIR = $(BUILD_DIR)/tools
1414

1515
GO_ENV_VARS = GO111MODULE=on GOOS=windows
1616

17+
# TODO: temporarily disable generate and lint because they are not working.
1718
.PHONY: all
18-
all: generate compile lint
19+
all: compile test
1920

2021
.PHONY: compile
2122
compile: compile-client compile-server compile-csi-proxy-api-gen
@@ -74,6 +75,14 @@ lint: $(GOLANGCI_LINT)
7475
$(GO_ENV_VARS) $(GOLANGCI_LINT) run
7576
git --no-pager diff --exit-code
7677

78+
.PHONY: test-go
79+
test: test-go
80+
test-go:
81+
@ echo; echo "### $@:"
82+
# TODO: After issue https://github.com/microsoft/go-winio/pull/169 is resolved, remove the filter on the test path.
83+
GO111MODULE=on go test `find ./internal/server/ -type d -not -name server`;\
84+
cd client && GO111MODULE=on go test `go list ./... | grep -v group` && cd ../
85+
7786
# see https://github.com/golangci/golangci-lint#binary-release
7887
$(GOLANGCI_LINT):
7988
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b "$$(dirname '$(GOLANGCI_LINT)')" '$(GOLANGCI_LINT_VERSION)'

release-tools/prow.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ configvar CSI_PROW_DEP_VERSION v0.5.1 "golang dep version to be used for vendor
242242
# thus only makes sense in repos which provide their own CSI
243243
# driver. Repos can enable sanity testing by setting
244244
# CSI_PROW_TESTS_SANITY=sanity.
245-
configvar CSI_PROW_TESTS "unit parallel serial parallel-alpha serial-alpha sanity" "tests to run"
245+
#configvar CSI_PROW_TESTS "unit parallel serial parallel-alpha serial-alpha sanity" "tests to run"
246246
tests_enabled () {
247247
local t1 t2
248248
# We want word-splitting here, so ignore: Quote to prevent word splitting, or split robustly with mapfile or read -a.
@@ -960,7 +960,8 @@ main () {
960960
fi
961961
fi
962962
# Required for E2E testing.
963-
run_with_go "${CSI_PROW_GO_VERSION_BUILD}" make container || die "'make container' failed"
963+
#Cannot build windows container on Linux node
964+
#run_with_go "${CSI_PROW_GO_VERSION_BUILD}" make container || die "'make container' failed"
964965
fi
965966
966967
if tests_need_kind; then

0 commit comments

Comments
 (0)