Merge pull request #18 from mikebrow/enable-unit-test

Enables unit tests for Travis build; address nits in Makefile; increase lint timeout to 5min
This commit is contained in:
Lantao Liu 2017-04-25 11:01:44 -07:00 committed by GitHub
commit 409b946be1
3 changed files with 12 additions and 8 deletions

View File

@ -17,3 +17,4 @@ script:
- make .gitvalidation - make .gitvalidation
- make verify - make verify
- make binaries - make binaries
- make test

View File

@ -17,7 +17,9 @@ EPOCH_TEST_COMMIT ?= f9e02affccd51702191e5312665a16045ffef8ab
PROJECT := github.com/kubernetes-incubator/cri-containerd PROJECT := github.com/kubernetes-incubator/cri-containerd
BINDIR ?= ${DESTDIR}/usr/local/bin BINDIR ?= ${DESTDIR}/usr/local/bin
BUILD_DIR ?= _output BUILD_DIR ?= _output
# VERSION is the version of the binary. # VERSION is derived from the current tag for HEAD plus amends. Version is used
# to set/overide the criContainerdVersion variable in the verison package for
# cri-containerd.
VERSION:=$(shell git describe --tags --dirty) VERSION:=$(shell git describe --tags --dirty)
BUILD_TAGS:= -ldflags '-X $(PROJECT)/pkg/version.criContainerdVersion=$(VERSION)' BUILD_TAGS:= -ldflags '-X $(PROJECT)/pkg/version.criContainerdVersion=$(VERSION)'
@ -30,7 +32,7 @@ help:
@echo @echo
@echo " * 'install' - Install binaries to system locations" @echo " * 'install' - Install binaries to system locations"
@echo " * 'binaries' - Build cri-containerd" @echo " * 'binaries' - Build cri-containerd"
@echo " * 'test' - Test cri-containerd" @echo " * 'test' - Test cri-containerd"
@echo " * 'clean' - Clean artifacts" @echo " * 'clean' - Clean artifacts"
@echo " * 'verify' - Execute the source code verification tools" @echo " * 'verify' - Execute the source code verification tools"
@echo " * 'install.tools' - Installs tools used by verify" @echo " * 'install.tools' - Installs tools used by verify"
@ -63,10 +65,10 @@ boiler:
cri-containerd: check-gopath cri-containerd: check-gopath
$(GO) build -o $(BUILD_DIR)/$@ \ $(GO) build -o $(BUILD_DIR)/$@ \
$(BUILD_TAGS) \ $(BUILD_TAGS) \
$(PROJECT)/cmd/cri-containerd $(PROJECT)/cmd/cri-containerd
test: test:
go test -timeout=1m -v -race ./pkg/... $(BUILD_TAGS) go test -timeout=1m -v -race ./pkg/... $(BUILD_TAGS)
clean: clean:
@ -81,7 +83,8 @@ uninstall:
rm -f $(BINDIR)/cri-containerd rm -f $(BINDIR)/cri-containerd
.PHONY: .gitvalidation .PHONY: .gitvalidation
# When this is running in travis, it will only check the travis commit range # When this is running in travis, it will only check the travis commit range.
# When running outside travis, it will check from $(EPOCH_TEST_COMMIT)..HEAD.
.gitvalidation: check-gopath .gitvalidation: check-gopath
ifeq ($(TRAVIS),true) ifeq ($(TRAVIS),true)
git-validation -q -run DCO,short-subject git-validation -q -run DCO,short-subject
@ -103,12 +106,12 @@ install.tools: .install.gitvalidation .install.gometalinter
.PHONY: \ .PHONY: \
binaries \ binaries \
boiler \ boiler \
test \
clean \ clean \
default \ default \
gofmt \ gofmt \
help \ help \
install \ install \
lint \ lint \
test \
uninstall \ uninstall \
version version

View File

@ -29,5 +29,5 @@ for d in $(find . -type d -a \( -iwholename './pkg*' -o -iwholename './cmd*' \))
--cyclo-over=60 \ --cyclo-over=60 \
--dupl-threshold=100 \ --dupl-threshold=100 \
--tests \ --tests \
--deadline=30s "${d}" --deadline=300s "${d}"
done done