Commit 17151b99 authored by mattjmcnaughton's avatar mattjmcnaughton

Add containerized options for tests in Makefile

Add an option to run the `test-unit`, `test-style`, and `test`
steps from the `Makefile` insides of a docker container. Doing so
isolates this component of helm development from any other aspect of
your global go environment.

These commands all have the name `docker-*`. Long term, there may
be reproducibility benefits to running all of the Make steps in a
container by default, in which case `containerized-test-unit` could
become `test-unit`.
parent 4589ae2c
DOCKER_REGISTRY ?= gcr.io
IMAGE_PREFIX ?= kubernetes-helm
DEV_IMAGE ?= golang:1.10
SHORT_NAME ?= tiller
SHORT_NAME_RUDDER ?= rudder
TARGETS ?= darwin/amd64 linux/amd64 linux/386 linux/arm linux/arm64 linux/ppc64le linux/s390x windows/amd64
......@@ -87,17 +88,39 @@ test: TESTFLAGS += -race -v
test: test-style
test: test-unit
.PHONY: docker-test
docker-test: docker-binary
docker-test: TESTFLAGS += -race -v
docker-test: docker-test-style
docker-test: docker-test-unit
.PHONY: test-unit
test-unit:
@echo
@echo "==> Running unit tests <=="
HELM_HOME=/no/such/dir $(GO) test $(GOFLAGS) -run $(TESTS) $(PKG) $(TESTFLAGS)
.PHONY: docker-test-unit
docker-test-unit: check-docker
docker run \
-v $(shell pwd):/go/src/k8s.io/helm \
-w /go/src/k8s.io/helm \
$(DEV_IMAGE) \
bash -c "HELM_HOME=/no/such/dir go test $(GOFLAGS) -run $(TESTS) $(PKG) $(TESTFLAGS)"
.PHONY: test-style
test-style:
@scripts/validate-go.sh
@scripts/validate-license.sh
.PHONY: docker-test-style
docker-test-style: check-docker
docker run \
-v $(CURDIR):/go/src/k8s.io/helm \
-w /go/src/k8s.io/helm \
$(DEV_IMAGE) \
bash -c "scripts/validate-go.sh && scripts/validate-license.sh"
.PHONY: protoc
protoc:
$(MAKE) -C _proto/ all
......
......@@ -27,7 +27,8 @@ This will build both Helm and Tiller. `make bootstrap` will attempt to
install certain tools if they are missing.
To run all the tests (without running the tests for `vendor/`), run
`make test`.
`make test`. To run all tests in a containerized environment, run `make
docker-test`.
To run Helm and Tiller locally, you can run `bin/helm` or `bin/tiller`.
......@@ -209,6 +210,9 @@ We follow the Go coding style standards very closely. Typically, running
We also typically follow the conventions recommended by `go lint` and
`gometalinter`. Run `make test-style` to test the style conformance.
If you do not want to install all the linters from `gometalinter` into your
global Go environment, you can run `make docker-test-style` which will
run the same tests, but isolated within a docker container.
Read more:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment