Build JMS tests from Makefile

This commit is contained in:
Arthur Barr
2018-03-21 10:12:36 +00:00
parent 94a4eac2ca
commit 54885597fa
4 changed files with 22 additions and 3 deletions

View File

@@ -53,6 +53,8 @@ NUM_CPU=$(shell docker info --format "{{ .NCPU }}")
# BASE_IMAGE_TAG is a normalized version of BASE_IMAGE, suitable for use in a Docker tag
BASE_IMAGE_TAG=$(subst /,-,$(subst :,-,$(BASE_IMAGE)))
MQ_IMAGE_DEVSERVER_BASE=mqadvanced-server-dev-base:$(MQ_VERSION)-$(ARCH)-$(BASE_IMAGE_TAG)
# Docker image name to use for JMS tests
DEV_JMS_IMAGE=mq-dev-jms-test
# Try to figure out which archive to use from the BASE_IMAGE
ifeq "$(findstring ubuntu,$(BASE_IMAGE))" "ubuntu"
@@ -137,10 +139,15 @@ test-advancedserver: test/docker/vendor
$(info $(SPACER)$(shell printf $(TITLE)"Test $(MQ_IMAGE_ADVANCEDSERVER) on Docker"$(END)))
cd test/docker && TEST_IMAGE=$(MQ_IMAGE_ADVANCEDSERVER) go test -parallel $(NUM_CPU) $(TEST_OPTS_DOCKER)
.PHONY: build-devjmstest
build-devjmstest:
$(info $(SPACER)$(shell printf $(TITLE)"Build JMS tests for developer config"$(END)))
cd test/messaging && docker build --tag $(DEV_JMS_IMAGE) .
.PHONY: test-devserver
test-devserver: test/docker/vendor
test-devserver: test/docker/vendor build-devjmstest
$(info $(SPACER)$(shell printf $(TITLE)"Test $(MQ_IMAGE_DEVSERVER) on Docker"$(END)))
cd test/docker && TEST_IMAGE=$(MQ_IMAGE_DEVSERVER) go test -parallel $(NUM_CPU) -tags mqdev $(TEST_OPTS_DOCKER)
cd test/docker && TEST_IMAGE=$(MQ_IMAGE_DEVSERVER) DEV_JMS_IMAGE=$(DEV_JMS_IMAGE) go test -parallel $(NUM_CPU) -tags mqdev $(TEST_OPTS_DOCKER)
.PHONY: test-advancedserver-cover
test-advancedserver-cover: test/docker/vendor

View File

@@ -29,6 +29,8 @@ import (
"github.com/docker/go-connections/nat"
)
// TestDevGoldenPath tests using the default values for the default developer config.
// Note: This test requires a separate container image to be available for the JMS tests.
func TestDevGoldenPath(t *testing.T) {
t.Parallel()
cli, err := client.NewEnvClient()
@@ -64,6 +66,8 @@ func TestDevGoldenPath(t *testing.T) {
stopContainer(t, cli, id)
}
// TestDevTLS tests the default developer config using the a custom TLS key store.
// Note: This test requires a separate container image to be available for the JMS tests
func TestDevTLS(t *testing.T) {
t.Parallel()
cli, err := client.NewEnvClient()

View File

@@ -73,7 +73,7 @@ func runJMSTests(t *testing.T, cli *client.Client, ID string, tls bool) {
"MQ_PASSWORD=" + devAppPassword,
"MQ_CHANNEL=DEV.APP.SVRCONN",
},
Image: "msgtest",
Image: imageNameDevJMS(),
}
if tls {
t.Log("Using TLS from JMS client")

View File

@@ -49,6 +49,14 @@ func imageName() string {
return image
}
func imageNameDevJMS() string {
image, ok := os.LookupEnv("DEV_JMS_IMAGE")
if !ok {
image = "mq-dev-jms-test"
}
return image
}
func coverage() bool {
cover := os.Getenv("TEST_COVER")
if cover == "true" || cover == "1" {