Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile-RHEL
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ MQ_ARCHIVE ?= IBM_MQ_$(MQ_VERSION_VRM)_LINUX_$(MQ_ARCHIVE_ARCH).tar.gz
# for Developers can be installed
MQ_ARCHIVE_DEV ?= $(MQ_ARCHIVE_DEV_$(MQ_VERSION))
# MQ_SDK_ARCHIVE specifies the archive to use for the MQ redistributable client, which is used for building the golang programs.
MQ_SDK_ARCHIVE ?= $(MQ_VERSION)-IBM-MQC-Redist-LinuxX64.tar.gz
MQ_SDK_ARCHIVE ?= 9.1.1.0-IBM-MQC-Redist-LinuxX64.tar.gz
# Options to `go test` for the Docker tests
TEST_OPTS_DOCKER ?=
# MQ_IMAGE_ADVANCEDSERVER is the name and tag of the built MQ Advanced image
Expand Down
9 changes: 7 additions & 2 deletions Makefile-UBUNTU
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ docker-version:

.PHONY: build-advancedserver
build-advancedserver: MQ_SDK_ARCHIVE=$(MQ_ARCHIVE)
build-advancedserver: downloads/$(MQ_ARCHIVE) docker-version build-golang-sdk
build-advancedserver: downloads/$(MQ_ARCHIVE) docker-version build-golang-sdk-ex
$(info $(SPACER)$(shell printf $(TITLE)"Build $(MQ_IMAGE_ADVANCEDSERVER)"$(END)))
$(call docker-build-mq,$(MQ_IMAGE_ADVANCEDSERVER),Dockerfile-server,$(MQ_ARCHIVE),"4486e8c4cc9146fd9b3ce1f14a2dfc5b","IBM MQ Advanced",$(MQ_VERSION))

Expand All @@ -243,7 +243,7 @@ else
build-devserver: MQ_PACKAGES=MQSeriesRuntime-*.rpm MQSeriesServer-*.rpm MQSeriesJava*.rpm MQSeriesJRE*.rpm MQSeriesGSKit*.rpm MQSeriesMsg*.rpm MQSeriesSamples*.rpm MQSeriesAMS-*.rpm MQSeriesWeb-*.rpm
endif
build-devserver: MQ_SDK_ARCHIVE=$(MQ_ARCHIVE_DEV)
build-devserver: downloads/$(MQ_ARCHIVE_DEV) docker-version build-golang-sdk
build-devserver: downloads/$(MQ_ARCHIVE_DEV) docker-version build-golang-sdk-ex
$(info $(shell printf $(TITLE)"Build $(MQ_IMAGE_DEVSERVER_BASE)"$(END)))
$(call docker-build-mq,$(MQ_IMAGE_DEVSERVER_BASE),Dockerfile-server,$(MQ_ARCHIVE_DEV),"98102d16795c4263ad9ca075190a2d4d","IBM MQ Advanced for Developers (Non-Warranted)",$(MQ_VERSION))
$(DOCKER) build --tag $(MQ_IMAGE_DEVSERVER) --build-arg IMAGE_SOURCE="$(IMAGE_SOURCE)" --build-arg IMAGE_REVISION="$(IMAGE_REVISION)" --build-arg IMAGE_TAG="$(MQ_IMAGE_DEVSERVER)" --build-arg BASE_IMAGE=$(MQ_IMAGE_DEVSERVER_BASE) --build-arg BUILDER_IMAGE=$(MQ_IMAGE_GOLANG_SDK) --build-arg MQM_UID=$(MQM_UID) --file incubating/mqadvanced-server-dev/Dockerfile .
Expand All @@ -253,6 +253,11 @@ build-advancedserver-cover: docker-version
$(DOCKER) build --build-arg BASE_IMAGE=$(MQ_IMAGE_ADVANCEDSERVER) -t $(MQ_IMAGE_ADVANCEDSERVER)-cover -f Dockerfile-server.cover .

.PHONY: build-explorer
ifeq "$(findstring ubuntu,$(BASE_IMAGE))" "ubuntu"
build-explorer: MQ_PACKAGES=ibmmq-explorer
else
build-explorer: MQ_PACKAGES=MQSeriesRuntime*.rpm MQSeriesJRE*.rpm MQSeriesExplorer*.rpm
endif
build-explorer: downloads/$(MQ_ARCHIVE_DEV) docker-pull
$(call docker-build-mq,mq-explorer:latest-$(ARCH),incubating/mq-explorer/Dockerfile,$(MQ_ARCHIVE_DEV),"98102d16795c4263ad9ca075190a2d4d","IBM MQ Advanced for Developers (Non-Warranted)",$(MQ_VERSION))

Expand Down
4 changes: 2 additions & 2 deletions incubating/mq-explorer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ FROM ubuntu:16.04
ARG MQ_URL=https://public.dhe.ibm.com/ibmdl/export/pub/software/websphere/messaging/mqadv/mqadv_dev911_ubuntu_x86-64.tar.gz

# The MQ packages to install
ARG MQ_PACKAGES="ibmmq-explorer"
ARG MQ_PACKAGES

ARG MQM_UID=999

Expand All @@ -29,7 +29,7 @@ RUN export DEBIAN_FRONTEND=noninteractive \
libxtst6

ADD install-mq.sh /usr/local/bin/
RUN chmod u+x /usr/local/bin/install-mq.sh $MQM_UID \
RUN chmod u+x /usr/local/bin/install-mq.sh \
&& install-mq.sh

ENV LANG=en_US.UTF-8
Expand Down
7 changes: 4 additions & 3 deletions incubating/mqadvanced-server-dev/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,12 @@ COPY --from=builder /go/src/github.com/ibm-messaging/mq-container/runmqserver /u
COPY --from=builder /go/src/github.com/ibm-messaging/mq-container/runmqdevserver /usr/local/bin/

# Copy template files
COPY --chown=mqm:mqm incubating/mqadvanced-server-dev/*.tpl /etc/mqm/
COPY incubating/mqadvanced-server-dev/*.tpl /etc/mqm/
# Copy web XML files for default developer configuration
COPY --chown=mqm:mqm incubating/mqadvanced-server-dev/web /etc/mqm/web
COPY incubating/mqadvanced-server-dev/web /etc/mqm/web

RUN chmod +x /usr/local/bin/runmq* \
RUN chown -R mqm:mqm /etc/mqm/* \
&& chmod +x /usr/local/bin/runmq* \
&& install --directory --mode 0775 --owner mqm --group root /run/runmqdevserver

EXPOSE 9443
Expand Down
4 changes: 4 additions & 0 deletions test/docker/devconfig_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import (
// 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()
if err != nil {
t.Fatal(err)
Expand Down Expand Up @@ -66,6 +67,7 @@ func TestDevGoldenPath(t *testing.T) {
// Note: This test requires a separate container image to be available for the JMS tests
func TestDevSecure(t *testing.T) {
t.Parallel()

cli, err := client.NewEnvClient()
if err != nil {
t.Fatal(err)
Expand Down Expand Up @@ -127,6 +129,7 @@ func TestDevSecure(t *testing.T) {

func TestDevWebDisabled(t *testing.T) {
t.Parallel()

cli, err := client.NewEnvClient()
if err != nil {
t.Fatal(err)
Expand Down Expand Up @@ -157,6 +160,7 @@ func TestDevWebDisabled(t *testing.T) {

func TestDevConfigDisabled(t *testing.T) {
t.Parallel()

cli, err := client.NewEnvClient()
if err != nil {
t.Fatal(err)
Expand Down
47 changes: 42 additions & 5 deletions test/docker/docker_api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import (

func TestLicenseNotSet(t *testing.T) {
t.Parallel()

cli, err := client.NewEnvClient()
if err != nil {
t.Fatal(err)
Expand All @@ -56,6 +57,7 @@ func TestLicenseNotSet(t *testing.T) {

func TestLicenseView(t *testing.T) {
t.Parallel()

cli, err := client.NewEnvClient()
if err != nil {
t.Fatal(err)
Expand All @@ -79,12 +81,14 @@ func TestLicenseView(t *testing.T) {
// TestGoldenPath starts a queue manager successfully when metrics are enabled
func TestGoldenPathWithMetrics(t *testing.T) {
t.Parallel()

goldenPath(t, true)
}

// TestGoldenPath starts a queue manager successfully when metrics are disabled
func TestGoldenPathNoMetrics(t *testing.T) {
t.Parallel()

goldenPath(t, false)
}

Expand Down Expand Up @@ -112,6 +116,7 @@ func goldenPath(t *testing.T, metric bool) {
// by Ubuntu
func TestSecurityVulnerabilitiesUbuntu(t *testing.T) {
t.Parallel()

cli, err := client.NewEnvClient()
if err != nil {
t.Fatal(err)
Expand Down Expand Up @@ -141,6 +146,7 @@ func TestSecurityVulnerabilitiesUbuntu(t *testing.T) {
// by Red Hat
func TestSecurityVulnerabilitiesRedHat(t *testing.T) {
t.Parallel()

cli, err := client.NewEnvClient()
if err != nil {
t.Fatal(err)
Expand All @@ -153,22 +159,25 @@ func TestSecurityVulnerabilitiesRedHat(t *testing.T) {
if rc != 0 {
t.Skip("Skipping test because container is not RedHat-based")
}
id, _, err := command.Run("buildah", "from", imageName())
id, _, err := command.Run("sudo", "buildah", "from", imageName())
if err != nil {
t.Log(id)
t.Fatal(err)
}
id = strings.TrimSpace(id)
defer command.Run("buildah", "rm", id)
mnt, _, err := command.Run("buildah", "mount", id)
mnt, _, err := command.Run("sudo", "buildah", "mount", id)
if err != nil {
t.Log(mnt)
t.Fatal(err)
}
mnt = strings.TrimSpace(mnt)
_, _, err = command.Run("bash", "-c", "cp /etc/yum.repos.d/* "+filepath.Join(mnt, "/etc/yum.repos.d/"))
out, _, err := command.Run("bash", "-c", "sudo cp /etc/yum.repos.d/* "+filepath.Join(mnt, "/etc/yum.repos.d/"))
if err != nil {
t.Log(out)
t.Fatal(err)
}
out, ret, _ := command.Run("bash", "-c", "yum --installroot="+mnt+" updateinfo list sec | grep /Sec")
out, ret, _ = command.Run("bash", "-c", "yum --installroot="+mnt+" updateinfo list sec | grep /Sec")
if ret != 1 {
t.Errorf("Expected no vulnerabilities, found the following:\n%v", out)
}
Expand All @@ -194,25 +203,29 @@ func utilTestNoQueueManagerName(t *testing.T, hostName string, expectedName stri
}
func TestNoQueueManagerName(t *testing.T) {
t.Parallel()

utilTestNoQueueManagerName(t, "test", "test")
}

func TestNoQueueManagerNameInvalidHostname(t *testing.T) {
t.Parallel()

utilTestNoQueueManagerName(t, "test-1", "test1")
}

// TestWithVolume runs a container with a Docker volume, then removes that
// container and starts a new one with same volume. With metrics enabled
func TestWithVolumeAndMetrics(t *testing.T) {
t.Parallel()

withVolume(t, true)
}

// TestWithVolume runs a container with a Docker volume, then removes that
// container and starts a new one with same volume. With metrics disabled
func TestWithVolumeNoMetrics(t *testing.T) {
t.Parallel()

withVolume(t, false)
}

Expand Down Expand Up @@ -264,6 +277,7 @@ func withVolume(t *testing.T, metric bool) {
// and restarted cleanly
func TestNoVolumeWithRestart(t *testing.T) {
t.Parallel()

cli, err := client.NewEnvClient()
if err != nil {
t.Fatal(err)
Expand All @@ -284,6 +298,7 @@ func TestNoVolumeWithRestart(t *testing.T) {
// where `runmqserver -i` is run to initialize the storage. Then the
// container can be run as normal.
func TestVolumeRequiresRoot(t *testing.T) {

cli, err := client.NewEnvClient()
if err != nil {
t.Fatal(err)
Expand Down Expand Up @@ -346,6 +361,7 @@ func TestVolumeRequiresRoot(t *testing.T) {
// TestCreateQueueManagerFail causes a failure of `crtmqm`
func TestCreateQueueManagerFail(t *testing.T) {
t.Parallel()

cli, err := client.NewEnvClient()
if err != nil {
t.Fatal(err)
Expand Down Expand Up @@ -380,6 +396,7 @@ func TestCreateQueueManagerFail(t *testing.T) {
// TestStartQueueManagerFail causes a failure of `strmqm`
func TestStartQueueManagerFail(t *testing.T) {
t.Parallel()

cli, err := client.NewEnvClient()
if err != nil {
t.Fatal(err)
Expand Down Expand Up @@ -417,6 +434,7 @@ func TestStartQueueManagerFail(t *testing.T) {
// attached storage gets unmounted.
func TestVolumeUnmount(t *testing.T) {
t.Parallel()

cli, err := client.NewEnvClient()
if err != nil {
t.Fatal(err)
Expand Down Expand Up @@ -465,6 +483,7 @@ func TestVolumeUnmount(t *testing.T) {
// created, then checks that no zombies exist (runmqserver should reap them)
func TestZombies(t *testing.T) {
t.Parallel()

cli, err := client.NewEnvClient()
if err != nil {
t.Fatal(err)
Expand Down Expand Up @@ -501,6 +520,7 @@ func TestZombies(t *testing.T) {
// on that image, and checks that the MQSC has been applied correctly.
func TestMQSC(t *testing.T) {
t.Parallel()

cli, err := client.NewEnvClient()
if err != nil {
t.Fatal(err)
Expand Down Expand Up @@ -575,6 +595,7 @@ func TestMQSC(t *testing.T) {
// WARNING: This test is sensitive to the speed of the machine it's running on.
func TestReadiness(t *testing.T) {
t.Parallel()

cli, err := client.NewEnvClient()
if err != nil {
t.Fatal(err)
Expand Down Expand Up @@ -629,29 +650,42 @@ func TestReadiness(t *testing.T) {

func TestErrorLogRotation(t *testing.T) {
t.Parallel()

cli, err := client.NewEnvClient()
if err != nil {
t.Fatal(err)
}

logsize := 65536

rc, _ := runContainerOneShot(t, cli, "bash", "-c", "test -d /etc/apt")
if rc != 0 {
// RHEL
logsize = 32768
}

qmName := "qm1"
containerConfig := container.Config{
Env: []string{
"LICENSE=accept",
"MQ_QMGR_NAME=" + qmName,
"MQMAXERRORLOGSIZE=65536",
fmt.Sprintf("MQMAXERRORLOGSIZE=%d", logsize),
"LOG_FORMAT=json",
fmt.Sprintf("AMQ_EXTRA_QM_STANZAS=QMErrorLog:ErrorLogSize=%d", logsize),
},
ExposedPorts: nat.PortSet{
"1414/tcp": struct{}{},
},
}

id := runContainer(t, cli, &containerConfig)
defer cleanContainer(t, cli, id)
waitForReady(t, cli, id)
dir := "/var/mqm/qmgrs/" + qmName + "/errors"
// Generate some content for the error logs, by trying to put messages under an unauthorized user
// execContainer(t, cli, id, "fred", []string{"bash", "-c", "for i in {1..30} ; do /opt/mqm/samp/bin/amqsput FAKE; done"})
execContainer(t, cli, id, "root", []string{"useradd", "fred"})

for {
execContainer(t, cli, id, "fred", []string{"bash", "-c", "/opt/mqm/samp/bin/amqsput FAKE"})

Expand Down Expand Up @@ -694,12 +728,14 @@ func TestErrorLogRotation(t *testing.T) {
// Tests the log comes out in JSON format when JSON format is enabled. With metrics enabled
func TestJSONLogFormatWithMetrics(t *testing.T) {
t.Parallel()

jsonLogFormat(t, true)
}

// Tests the log comes out in JSON format when JSON format is enabled. With metrics disabled
func TestJSONLogFormatNoMetrics(t *testing.T) {
t.Parallel()

jsonLogFormat(t, false)
}

Expand Down Expand Up @@ -740,6 +776,7 @@ func jsonLogFormat(t *testing.T, metric bool) {

func TestBadLogFormat(t *testing.T) {
t.Parallel()

cli, err := client.NewEnvClient()
if err != nil {
t.Fatal(err)
Expand Down
4 changes: 2 additions & 2 deletions test/docker/docker_api_test_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ func runContainerOneShot(t *testing.T, cli *client.Client, command ...string) (i
t.Fatal(err)
}
defer cleanContainerQuiet(t, cli, ctr.ID)
rc := waitForContainer(t, cli, ctr.ID, 10*time.Second)
rc := waitForContainer(t, cli, ctr.ID, 20*time.Second)
out := inspectLogs(t, cli, ctr.ID)
t.Logf("One shot container finished with rc=%v, output=%v", rc, out)
return rc, out
Expand Down Expand Up @@ -374,7 +374,7 @@ func runContainerOneShotWithVolume(t *testing.T, cli *client.Client, bind string
t.Fatal(err)
}
defer cleanContainerQuiet(t, cli, ctr.ID)
rc := waitForContainer(t, cli, ctr.ID, 10*time.Second)
rc := waitForContainer(t, cli, ctr.ID, 20*time.Second)
out := inspectLogs(t, cli, ctr.ID)
t.Logf("One shot container finished with rc=%v, output=%v", rc, out)
return rc, out
Expand Down
Loading