From baec4688cb547c5283b260088ca1ed36451453ca Mon Sep 17 00:00:00 2001 From: Tom Wilkie Date: Fri, 15 Jan 2016 09:36:35 -0800 Subject: [PATCH] Various improvements to build & tests - Fix broken wait in tests. - Run lint in the build container. - Merge two quick steps in the circle plan. - Increase number of test VMs to 3 (again). --- Makefile | 10 +++++----- backend/Dockerfile | 4 ++++ circle.yml | 6 ++---- integration/config.sh | 2 +- integration/gce.sh | 2 +- 5 files changed, 13 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index 718e7fb68..fe98f258f 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: all deps static clean client-lint client-test client-sync backend frontend shell +.PHONY: all deps static clean client-lint client-test client-sync backend frontend shell lint # If you can use Docker without being root, you can `make SUDO= ` SUDO=sudo -E @@ -42,7 +42,7 @@ $(SCOPE_EXE): $(shell find ./ -path ./vendor -prune -o -type f -name *.go) prog/ ifeq ($(BUILD_IN_CONTAINER),true) -$(SCOPE_EXE) $(RUNSVINIT) tests shell: $(SCOPE_BACKEND_BUILD_UPTODATE) +$(SCOPE_EXE) $(RUNSVINIT) lint tests shell: $(SCOPE_BACKEND_BUILD_UPTODATE) @mkdir -p $(shell pwd)/.pkg $(SUDO) docker run $(RM) $(RUN_FLAGS) \ -v $(shell pwd):/go/src/github.com/weaveworks/scope \ @@ -73,6 +73,9 @@ shell: tests: ./tools/test -no-go-get +lint: + ./tools/lint . + endif static: prog/static.go @@ -122,9 +125,6 @@ clean: deps: go get -u -f -tags netgo \ - github.com/golang/lint/golint \ - github.com/fzipp/gocyclo \ github.com/mattn/goveralls \ github.com/mjibson/esc \ - github.com/kisielk/errcheck \ github.com/weaveworks/github-release diff --git a/backend/Dockerfile b/backend/Dockerfile index a517a0cba..eff72a823 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -2,5 +2,9 @@ FROM golang:1.5.3 ENV GO15VENDOREXPERIMENT 1 RUN apt-get update && apt-get install -y libpcap-dev python-requests time RUN go clean -i net && go install -tags netgo std && go install -race -tags netgo std +RUN go get -tags netgo \ + github.com/golang/lint/golint \ + github.com/fzipp/gocyclo \ + github.com/kisielk/errcheck COPY build.sh / ENTRYPOINT ["/build.sh"] diff --git a/circle.yml b/circle.yml index ddfe671a5..de1e3fa63 100644 --- a/circle.yml +++ b/circle.yml @@ -29,13 +29,11 @@ dependencies: test: override: - - cd $SRCDIR; ./tools/lint .: + - cd $SRCDIR; make RM= lint: parallel: true - cd $SRCDIR; COVERDIR=./coverage make RM= tests: parallel: true - - cd $SRCDIR; make RM= client-test: - parallel: true - - cd $SRCDIR; make RM= static: + - cd $SRCDIR; make RM= client-test static: parallel: true - cd $SRCDIR; rm -f prog/scope; if [ "$CIRCLE_NODE_INDEX" = "0" ]; then GOARCH=arm make GO_BUILD_INSTALL_DEPS= RM= prog/scope; else GOOS=darwin make GO_BUILD_INSTALL_DEPS= RM= prog/scope; fi: parallel: true diff --git a/integration/config.sh b/integration/config.sh index f31e54bb2..f25342810 100644 --- a/integration/config.sh +++ b/integration/config.sh @@ -87,7 +87,7 @@ wait_for() { local view="$1" local host="$2" local timeout="$3" - shift 2 + shift 3 for i in $(seq ${timeout}); do local nodes="$(curl -s http://$host:4040/api/topology/${view}?system=show)" diff --git a/integration/gce.sh b/integration/gce.sh index dbd672709..c53089846 100755 --- a/integration/gce.sh +++ b/integration/gce.sh @@ -6,5 +6,5 @@ set -e export PROJECT=scope-integration-tests export TEMPLATE_NAME="test-template-4" -export NUM_HOSTS=2 +export NUM_HOSTS=3 . "../tools/integration/gce.sh" "$@"