Add test fixes and fix mq-explorer build
This commit is contained in:
@@ -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))
|
||||
|
||||
@@ -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 .
|
||||
@@ -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))
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -71,11 +71,13 @@ 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/* \
|
||||
&& ls -lar /etc/mqm/ \
|
||||
&& chmod +x /usr/local/bin/runmq* \
|
||||
&& install --directory --mode 0775 --owner mqm --group root /run/runmqdevserver
|
||||
|
||||
EXPOSE 9443
|
||||
|
||||
@@ -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)
|
||||
@@ -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)
|
||||
@@ -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)
|
||||
@@ -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)
|
||||
|
||||
@@ -40,6 +40,7 @@ import (
|
||||
|
||||
func TestLicenseNotSet(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
cli, err := client.NewEnvClient()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -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)
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
@@ -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)
|
||||
@@ -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)
|
||||
}
|
||||
@@ -194,11 +203,13 @@ 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")
|
||||
}
|
||||
|
||||
@@ -206,6 +217,7 @@ func TestNoQueueManagerNameInvalidHostname(t *testing.T) {
|
||||
// container and starts a new one with same volume. With metrics enabled
|
||||
func TestWithVolumeAndMetrics(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
withVolume(t, true)
|
||||
}
|
||||
|
||||
@@ -213,6 +225,7 @@ func TestWithVolumeAndMetrics(t *testing.T) {
|
||||
// container and starts a new one with same volume. With metrics disabled
|
||||
func TestWithVolumeNoMetrics(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
withVolume(t, false)
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
@@ -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)
|
||||
@@ -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)
|
||||
@@ -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)
|
||||
@@ -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)
|
||||
@@ -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)
|
||||
@@ -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)
|
||||
@@ -538,6 +558,7 @@ func TestMQSC(t *testing.T) {
|
||||
// tries to start a container based on that image, and checks that container terminates
|
||||
func TestInvalidMQSC(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
cli, err := client.NewEnvClient()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -575,6 +596,7 @@ func TestInvalidMQSC(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)
|
||||
@@ -629,22 +651,34 @@ 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)
|
||||
@@ -652,8 +686,11 @@ func TestErrorLogRotation(t *testing.T) {
|
||||
// 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"})
|
||||
_, atoiStr1 := execContainer(t, cli, id, "mqm", []string{"bash", "-c", "wc -c < " + filepath.Join(dir, "AMQERR01.json")})
|
||||
amqerr01size, _ := strconv.Atoi(atoiStr1)
|
||||
|
||||
_, atoiStr := execContainer(t, cli, id, "mqm", []string{"bash", "-c", "wc -c < " + filepath.Join(dir, "AMQERR02.json")})
|
||||
amqerr02size, _ := strconv.Atoi(atoiStr)
|
||||
@@ -694,12 +731,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)
|
||||
}
|
||||
|
||||
@@ -740,6 +779,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)
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
@@ -27,6 +27,7 @@ import (
|
||||
|
||||
func TestGoldenPathMetric(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
cli, err := client.NewEnvClient()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -53,6 +54,7 @@ func TestGoldenPathMetric(t *testing.T) {
|
||||
|
||||
func TestMetricNames(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
cli, err := client.NewEnvClient()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -96,6 +98,7 @@ func TestMetricNames(t *testing.T) {
|
||||
|
||||
func TestMetricLabels(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
requiredLabels := []string{"qmgr"}
|
||||
cli, err := client.NewEnvClient()
|
||||
if err != nil {
|
||||
@@ -144,6 +147,7 @@ func TestMetricLabels(t *testing.T) {
|
||||
|
||||
func TestRapidFirePrometheus(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
cli, err := client.NewEnvClient()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -177,6 +181,7 @@ func TestRapidFirePrometheus(t *testing.T) {
|
||||
|
||||
func TestSlowPrometheus(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
cli, err := client.NewEnvClient()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -207,6 +212,7 @@ func TestSlowPrometheus(t *testing.T) {
|
||||
|
||||
func TestContainerRestart(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
cli, err := client.NewEnvClient()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -254,6 +260,7 @@ func TestContainerRestart(t *testing.T) {
|
||||
|
||||
func TestQMRestart(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
cli, err := client.NewEnvClient()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -311,6 +318,7 @@ func TestQMRestart(t *testing.T) {
|
||||
|
||||
func TestValidValues(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
cli, err := client.NewEnvClient()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -346,6 +354,7 @@ func TestValidValues(t *testing.T) {
|
||||
|
||||
func TestChangingValues(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
cli, err := client.NewEnvClient()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
|
||||
Reference in New Issue
Block a user