mirror of https://github.com/ceph/go-ceph
tests: add USE_CACHE variable to enable go packages cache
If the make variable USE_CACHE is set, the test container will mount the /go directory from a named volume that is reused in following test runs, so that go dependencies don't have to be installed again. Signed-off-by: Sven Anderson <sven@redhat.com>
This commit is contained in:
parent
5c49aab11e
commit
5cb1f79d74
10
Makefile
10
Makefile
|
@ -27,6 +27,10 @@ ifneq ($(USE_PTRGUARD),)
|
|||
BUILD_TAGS := $(BUILD_TAGS),ptrguard
|
||||
endif
|
||||
|
||||
ifneq ($(USE_CACHE),)
|
||||
GOCACHE_VOLUME := -v test_ceph_go_cache:/go
|
||||
endif
|
||||
|
||||
SELINUX := $(shell getenforce 2>/dev/null)
|
||||
ifeq ($(SELINUX),Enforcing)
|
||||
VOLUME_FLAGS = :z
|
||||
|
@ -46,7 +50,9 @@ test:
|
|||
.PHONY: test-docker test-container test-multi-container
|
||||
test-docker: test-container
|
||||
test-container: $(BUILDFILE) $(RESULTS_DIR)
|
||||
$(CONTAINER_CMD) run $(CONTAINER_OPTS) --rm --hostname test_ceph_aio -v $(CURDIR):/go/src/github.com/ceph/go-ceph$(VOLUME_FLAGS) $(RESULTS_VOLUME) $(CI_IMAGE_TAG) $(ENTRYPOINT_ARGS)
|
||||
$(CONTAINER_CMD) run $(CONTAINER_OPTS) --rm --hostname test_ceph_aio \
|
||||
-v $(CURDIR):/go/src/github.com/ceph/go-ceph$(VOLUME_FLAGS) $(RESULTS_VOLUME) $(GOCACHE_VOLUME) \
|
||||
$(CI_IMAGE_TAG) $(ENTRYPOINT_ARGS)
|
||||
test-multi-container: $(BUILDFILE) $(RESULTS_DIR)
|
||||
$(CONTAINER_CMD) kill test_ceph_a test_ceph_b 2>/dev/null || true
|
||||
$(CONTAINER_CMD) volume remove test_ceph_a_data test_ceph_b_data 2>/dev/null || true
|
||||
|
@ -57,7 +63,7 @@ test-multi-container: $(BUILDFILE) $(RESULTS_DIR)
|
|||
-v test_ceph_b_data:/tmp/ceph $(CI_IMAGE_TAG) --test-run=NONE --pause
|
||||
$(CONTAINER_CMD) run $(CONTAINER_OPTS) --rm \
|
||||
--net test_ceph_net -v test_ceph_a_data:/ceph_a -v test_ceph_b_data:/ceph_b \
|
||||
-v $(CURDIR):/go/src/github.com/ceph/go-ceph$(VOLUME_FLAGS) $(RESULTS_VOLUME) \
|
||||
-v $(CURDIR):/go/src/github.com/ceph/go-ceph$(VOLUME_FLAGS) $(RESULTS_VOLUME) $(GOCACHE_VOLUME) \
|
||||
$(CI_IMAGE_TAG) --wait-for=/ceph_a/.ready:/ceph_b/.ready --ceph-conf=/ceph_a/ceph.conf \
|
||||
--mirror=/ceph_b/ceph.conf $(ENTRYPOINT_ARGS)
|
||||
$(CONTAINER_CMD) kill test_ceph_a test_ceph_b
|
||||
|
|
|
@ -25,6 +25,7 @@ ENV GOROOT=/opt/go
|
|||
ENV GO111MODULE=on
|
||||
ENV GOPATH /go
|
||||
ENV GODEBUG=cgocheck=2
|
||||
ENV GOCACHE=/go/cache
|
||||
WORKDIR /go/src/github.com/ceph/go-ceph
|
||||
VOLUME /go/src/github.com/ceph/go-ceph
|
||||
|
||||
|
|
Loading…
Reference in New Issue