ci: add test-multi-container Makefile target

Signed-off-by: Sven Anderson <sven@redhat.com>
This commit is contained in:
Sven Anderson 2021-03-03 22:18:05 +01:00 committed by John Mulligan
parent 362929f8d1
commit 9bd143e06e
1 changed files with 14 additions and 1 deletions

View File

@ -43,10 +43,23 @@ fmt:
test:
go test -v -tags $(BUILD_TAGS) ./...
.PHONY: test-docker test-container
.PHONY: test-docker test-container test-multi-container
test-docker: test-container
test-container: $(BUILDFILE) $(RESULTS_DIR)
$(CONTAINER_CMD) run $(CONTAINER_OPTS) --rm -v $(CURDIR):/go/src/github.com/ceph/go-ceph$(VOLUME_FLAGS) $(RESULTS_VOLUME) $(CI_IMAGE_TAG)
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
$(CONTAINER_CMD) network create test_ceph_net 2>/dev/null || true
$(CONTAINER_CMD) run $(CONTAINER_OPTS) --rm -d --name test_ceph_a --net test_ceph_net \
-v test_ceph_a_data:/tmp/ceph $(CI_IMAGE_TAG) --test-run=NONE --pause
$(CONTAINER_CMD) run $(CONTAINER_OPTS) --rm -d --name test_ceph_b --net test_ceph_net \
-v test_ceph_b_data:/tmp/ceph $(CI_IMAGE_TAG) --test-run=NONE --pause
$(CONTAINER_CMD) run --device /dev/fuse --cap-add SYS_ADMIN $(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) \
$(CI_IMAGE_TAG) --wait-for=/ceph_a/.ready:/ceph_b/.ready --ceph-conf=/ceph_a/ceph.conf
$(CONTAINER_CMD) kill test_ceph_a test_ceph_b
ifdef RESULTS_DIR
$(RESULTS_DIR):