Merge pull request #122 from arthurbarr/master

Add manifests, and improve tests
This commit is contained in:
Rob Parker
2018-06-14 09:54:36 +01:00
committed by GitHub
11 changed files with 233 additions and 71 deletions

View File

@@ -1 +1,2 @@
downloads
.git

10
manifests/README.md Normal file
View File

@@ -0,0 +1,10 @@
Fat manifests
=============
These are the fat manifests used by Docker Hub to handle images with multiple CPU architectures.
They are used in conjunction with [manifest-tool](https://github.com/estesp/manifest-tool), for example:
```sh
manifest-tool push from-spec manifest-latest.yaml
```

View File

@@ -0,0 +1,29 @@
# © Copyright IBM Corporation 2018
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
image: ibmcom/mq:9-cd
manifests:
- image: ibmcom/mq:9.0.5.0-x86_64
platform:
architecture: amd64
os: linux
- image: ibmcom/mq:9.0.5.0-ppc64le
platform:
architecture: ppc64le
os: linux
- image: ibmcom/mq:9.0.5.0-s390x
platform:
architecture: s390x
os: linux

29
manifests/manifest-9.yaml Normal file
View File

@@ -0,0 +1,29 @@
# © Copyright IBM Corporation 2018
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
image: ibmcom/mq:9
manifests:
- image: ibmcom/mq:9.0.5.0-x86_64
platform:
architecture: amd64
os: linux
- image: ibmcom/mq:9.0.5.0-ppc64le
platform:
architecture: ppc64le
os: linux
- image: ibmcom/mq:9.0.5.0-s390x
platform:
architecture: s390x
os: linux

View File

@@ -0,0 +1,29 @@
# © Copyright IBM Corporation 2018
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
image: ibmcom/mq:cd
manifests:
- image: ibmcom/mq:9.0.5.0-x86_64
platform:
architecture: amd64
os: linux
- image: ibmcom/mq:9.0.5.0-ppc64le
platform:
architecture: ppc64le
os: linux
- image: ibmcom/mq:9.0.5.0-s390x
platform:
architecture: s390x
os: linux

View File

@@ -0,0 +1,29 @@
# © Copyright IBM Corporation 2018
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
image: ibmcom/mq:latest
manifests:
- image: ibmcom/mq:9.0.5.0-x86_64
platform:
architecture: amd64
os: linux
- image: ibmcom/mq:9.0.5.0-ppc64le
platform:
architecture: ppc64le
os: linux
- image: ibmcom/mq:9.0.5.0-s390x
platform:
architecture: s390x
os: linux

View File

@@ -51,23 +51,22 @@ func waitForWebReady(t *testing.T, cli *client.Client, ID string, tlsConfig *tls
},
}
url := fmt.Sprintf("https://localhost:%s/ibmmq/rest/v1/admin/installation", getPort(t, cli, ID, 9443))
ctx, cancel := context.WithTimeout(context.Background(), 2*time.Minute)
defer cancel()
for {
req, err := http.NewRequest("GET", url, nil)
req.SetBasicAuth("admin", devAdminPassword)
resp, err := httpClient.Do(req)
if err == nil && resp.StatusCode == http.StatusOK {
t.Log("MQ web server is ready")
return
select {
case <-time.After(1 * time.Second):
req, err := http.NewRequest("GET", url, nil)
req.SetBasicAuth("admin", devAdminPassword)
resp, err := httpClient.Do(req.WithContext(ctx))
if err == nil && resp.StatusCode == http.StatusOK {
t.Log("MQ web server is ready")
return
}
case <-ctx.Done():
t.Fatal("Timed out waiting for web server to become ready")
}
// conn, err := tls.Dial("tcp", a, &config)
// if err == nil {
// conn.Close()
// // Extra sleep to allow web apps to start
// time.Sleep(5 * time.Second)
// t.Log("MQ web server is ready")
// return
// }
time.Sleep(1 * time.Second)
}
}

View File

@@ -387,11 +387,19 @@ rerun:
}
func waitForReady(t *testing.T, cli *client.Client, ID string) {
ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
defer cancel()
for {
rc, _ := execContainer(t, cli, ID, "mqm", []string{"chkmqready"})
if rc == 0 {
t.Log("MQ is ready")
return
select {
case <-time.After(1 * time.Second):
rc, _ := execContainer(t, cli, ID, "mqm", []string{"chkmqready"})
if rc == 0 {
t.Log("MQ is ready")
return
}
case <-ctx.Done():
t.Fatal("Timed out waiting for container to become ready")
}
}
}

View File

@@ -13,26 +13,24 @@
# limitations under the License.
###############################################################################
# Application build environment (Gradle)
# Application build environment (Maven)
###############################################################################
FROM gradle as builder
ENV GRADLE_OPTS="-Dorg.gradle.daemon=false"
# Change where Gradle stores its cache, so that it's not under a volume
# (and therefore gets cached by Docker)
ENV GRADLE_USER_HOME=/home/gradle/gradle
RUN mkdir -p $GRADLE_USER_HOME
COPY --chown=gradle build.gradle /app/
WORKDIR /app
FROM maven:3-ibmjava as builder
COPY pom.xml /usr/src/mymaven/
WORKDIR /usr/src/mymaven
# Download dependencies separately, so Docker caches them
RUN gradle download
RUN mvn dependency:go-offline install
# Copy source
COPY --chown=gradle src /app/src
COPY src /usr/src/mymaven/src
# Run the main build
RUN gradle install
RUN mvn --offline install
# Print a list of all the files (useful for debugging)
RUN find /usr/src/mymaven
###############################################################################
# Application runtime (JRE only, no build environment)
###############################################################################
FROM ibmjava:sfj
COPY --from=builder /app/lib/*.jar /opt/app/
COPY --from=builder /usr/src/mymaven/target/*.jar /opt/app/
COPY --from=builder /usr/src/mymaven/target/lib/*.jar /opt/app/
ENTRYPOINT ["java", "-classpath", "/opt/app/*", "org.junit.platform.console.ConsoleLauncher", "-p", "com.ibm.mqcontainer.test", "--details", "verbose"]

View File

@@ -1,39 +0,0 @@
// © Copyright IBM Corporation 2018
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
apply plugin: 'java'
repositories {
mavenCentral()
}
dependencies {
compile group: 'com.ibm.mq', name: 'com.ibm.mq.allclient', version: '9.0.5.0'
compile "org.junit.jupiter:junit-jupiter-api:5.0.3"
runtime "org.junit.jupiter:junit-jupiter-engine:5.0.3"
runtime "org.junit.platform:junit-platform-console-standalone:1.0.3"
}
task download(type: Exec) {
configurations.runtime.files
commandLine 'echo', 'Downloaded all dependencies'
}
// Copy all dependencies to the lib directory
task install(type: Copy) {
dependsOn build
from configurations.runtime
from jar
into "${project.projectDir}/lib"
}

69
test/messaging/pom.xml Normal file
View File

@@ -0,0 +1,69 @@
<!--
© Copyright IBM Corporation 2018
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.ibm.mq.container</groupId>
<artifactId>test-messaging</artifactId>
<packaging>jar</packaging>
<version>dev</version>
<name>test-messaging</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>com.ibm.mq</groupId>
<artifactId>com.ibm.mq.allclient</artifactId>
<version>9.0.5.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.2.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.2.0</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-console-standalone</artifactId>
<version>1.2.0</version>
<scope>runtime</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<phase>install</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>