Skip to content

Commit 2658cb8

Browse files
authored
Merge pull request #4 from rh-openjdk/jdk21_update
Updates to test code to support JDK 21 containers. Correct usage label for UBI8 images.
2 parents ae707c8 + ebe5b92 commit 2658cb8

File tree

8 files changed

+56
-20
lines changed

8 files changed

+56
-20
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@ This test suite is designed to be executed against current versions of Red Hat's
99
| UBI 8 | 8 | [openjdk-8](https://catalog.redhat.com/software/containers/ubi8/openjdk-8/5dd6a48dbed8bd164a09589a) |
1010
| UBI 8 | 11 | [openjdk-11](https://catalog.redhat.com/software/containers/ubi8/openjdk-11/5dd6a4b45a13461646f677f4) |
1111
| UBI 8 | 17 | [openjdk-17](https://catalog.redhat.com/software/containers/ubi8/openjdk-17/618bdbf34ae3739687568813) |
12+
| UBI 8 | 21 | TBD |
1213
| UBI 9 | 11 | [openjdk-11](https://catalog.redhat.com/software/containers/ubi9/openjdk-11/61ee7bafed74b2ffb22b07ab) |
1314
| UBI 9 | 17 | [openjdk-17](https://catalog.redhat.com/software/containers/ubi9/openjdk-17/61ee7c26ed74b2ffb22b07f6) |
15+
| UBI 9 | 21 | TBD |
1416
**Note**: `OpenJDK runtime images are not currently supported by this test suite.`
1517

1618
***
@@ -31,6 +33,7 @@ To execute the test suite by hand against a defined version of Red Hat's OpenJDK
3133
* `MAVEN_HOME=/usr/bin/ mvn clean test -P 8 -P smoke -Dmaven.home=/usr/bin/`
3234
* `MAVEN_HOME=/usr/bin/ mvn clean test -P 11 -P smoke -Dmaven.home=/usr/bin/`
3335
* `MAVEN_HOME=/usr/bin/ mvn clean test -P 17 -P smoke -Dmaven.home=/usr/bin/`
36+
* `MAVEN_HOME=/usr/bin/ mvn clean test -P 21 -P smoke -Dmaven.home=/usr/bin/`
3437

3538
Notice this will execute the test for OpenJDK version 8, 11, or 17. These are the only versions that are supported for testing. To simplify the test execution a `run.sh` has been added. This is the preferred approach to executing tests against the UBI 8 and UBI 9 images.
3639

@@ -39,6 +42,7 @@ For UBI 8 and UBI 9 images it is recommended to use the bash script for the exec
3942
bash run.sh --jdk-version=8
4043
bash run.sh --jdk-version=11
4144
bash run.sh --jdk-version=17
45+
bash run.sh --jdk-version=21
4246
```
4347

4448
## Configuration

global-test.properties

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,21 @@
33
#############################################
44

55
# UBI 8 (Rhel 8) version of the container
6-
xtf.openjdk.8.image=registry.access.redhat.com/ubi8/openjdk-8:1.17-1.1693366248
6+
xtf.openjdk.8.image=registry.access.redhat.com/ubi8/openjdk-8:1.18-2
77
xtf.openjdk.8.version=1.8.0
88

99
# UBI 8 (Rhel 8) version of the container
10-
xtf.openjdk.11.image=registry.access.redhat.com/ubi8/openjdk-11:1.17-1.1693366250
10+
xtf.openjdk.11.image=registry.access.redhat.com/ubi8/openjdk-11:1.18-2
1111
xtf.openjdk.11.version=11
1212

1313
#JDK 17 image reference
14-
xtf.openjdk.17.image=registry.access.redhat.com/ubi8/openjdk-17:1.17-1.1693366272
14+
xtf.openjdk.17.image=registry.access.redhat.com/ubi8/openjdk-17:1.18-2
1515
xtf.openjdk.17.version=17
1616

17+
#JDK 21 image reference
18+
xtf.openjdk.21.image=registry.access.redhat.com/ubi8/openjdk-21:1.18-3
19+
xtf.openjdk.21.version=21
20+
1721
#############################################
1822
xtf.openshift.namespace=jdk
1923
xtf.bm.namespace=jdk-build

run.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ do
4747
done
4848

4949
# Check the OpenJDK Version to make sure the tests supports it.
50-
if [ $OPENJDK_VERSION -eq 8 ] || [ $OPENJDK_VERSION -eq 11 ] || [ $OPENJDK_VERSION -eq 17 ] ; then
50+
if [ $OPENJDK_VERSION -eq 8 ] || [ $OPENJDK_VERSION -eq 11 ] || [ $OPENJDK_VERSION -eq 17 ] || [ $OPENJDK_VERSION -eq 21 ] ; then
5151
echo "OpenJDK version under test is: $OPENJDK_VERSION"
5252
else
5353
echo "Unsupported OpenJDK version detected."
@@ -106,3 +106,4 @@ MAVEN_HOME=/usr/share/maven mvn clean test -P $OPENJDK_VERSION -P smoke -Dmaven.
106106
# MAVEN_HOME=/usr/share/maven mvn clean test -P 8 -P smoke -Dmaven.home=/usr/share/maven
107107
# MAVEN_HOME=/usr/share/maven mvn clean test -P 11 -P smoke -Dmaven.home=/usr/share/maven
108108
# MAVEN_HOME=/usr/share/maven mvn clean test -P 17 -P smoke -Dmaven.home=/usr/share/maven
109+
# MAVEN_HOME=/usr/share/maven mvn clean test -P 21 -P smoke -Dmaven.home=/usr/share/maven

test-openjdk/pom.xml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,12 @@
211211
<xtf.openjdk.subid>17</xtf.openjdk.subid>
212212
</properties>
213213
</profile>
214+
<profile>
215+
<id>21</id>
216+
<properties>
217+
<xtf.openjdk.subid>21</xtf.openjdk.subid>
218+
</properties>
219+
</profile>
214220
<profile>
215221
<id>smoke</id>
216222
<properties>
@@ -231,12 +237,7 @@
231237
</activation>
232238
<dependencies>
233239
<dependency>
234-
<!--Need tools.jar in compilation classpath. JDK 1.7 no longer has it there by default: -->
235-
<groupId>com.sun</groupId>
236-
<artifactId>tools</artifactId>
237-
<version>${maven.compiler.target}</version>
238-
<scope>system</scope>
239-
<systemPath>${java.home}/../lib/tools.jar</systemPath>
240+
240241
</dependency>
241242
</dependencies>
242243
</profile>

test-openjdk/src/test/java/com/redhat/qe/openjdk/OpenJDKTestConfig.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ public static boolean isOpenJDK17() {
4545
return image().getRepo().contains("openjdk-17");
4646
}
4747

48+
public static boolean isOpenJDK21() {
49+
return image().getRepo().contains("openjdk-21");
50+
}
51+
4852
// Need to spell out the Rhel 7-based builds because they do not follow the newer
4953
// naming conventions.
5054
public static boolean isOpenJDK8Rhel7() {

test-openjdk/src/test/java/com/redhat/qe/openjdk/image/AbstractDockerImageTest.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,14 @@ public abstract class AbstractDockerImageTest extends OpenJDKTestParent {
5757
"jps", "jrunscript", "jshell", "jstack", "jstat",
5858
"jstatd", "keytool", "rmiregistry", "serialver"
5959
};
60-
60+
public static final String[] DEFAULT_JAVA_21_UTILITIES = new String[]{
61+
"alt-java", "jarsigner", "javac", "javap", "jconsole",
62+
"jdeprscan", "jfr", "jimage", "jlink", "jmod", "jps",
63+
"jshell", "jstat", "jwebserver", "rmiregistry", "jar",
64+
"java", "javadoc", "jcmd", "jdb", "jdeps", "jhsdb",
65+
"jinfo", "jmap", "jpackage", "jrunscript", "jstack",
66+
"jstatd", "keytool", "serialver"
67+
};
6168
public static final String RED_HAT_RELEASE_KEY_2 = "199e2f91fd431d51";
6269

6370
protected static final OpenShift openShift = OpenShifts.master();

test-openjdk/src/test/java/com/redhat/qe/openjdk/image/DockerImageTest.java

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public void testEnvironmentVariablesInContainer() {
107107
public void testExposedTcpPorts() {
108108
// Port 8778 is from Jolokia and this has been pulled from the JDK17 containers.
109109
// This port has also been removed from the ubi9 images.
110-
if ( OpenJDKTestConfig.isOpenJDK17() || OpenJDKTestConfig.isRHEL9()) {
110+
if ( OpenJDKTestConfig.isOpenJDK17() || OpenJDKTestConfig.isOpenJDK21() || OpenJDKTestConfig.isRHEL9()) {
111111
Assertions.assertThat(metadata.exposedPorts("tcp")).containsOnly(8080, 8443);
112112
} else {
113113
Assertions.assertThat(metadata.exposedPorts("tcp")).containsOnly(8080, 8443, 8778);
@@ -126,11 +126,15 @@ public void testUsageLabel() {
126126
if (OpenJDKTestConfig.isRHEL7()){
127127
Assertions.assertThat(metadata.labels().get("usage")).isEqualTo("https://access.redhat.com/documentation/en-us/red_hat_jboss_middleware_for_openshift/3/html/red_hat_java_s2i_for_openshift/");
128128
} else if( OpenJDKTestConfig.isOpenJDK8() ) {
129-
Assertions.assertThat(metadata.labels().get("usage")).isEqualTo("https://access.redhat.com/documentation/en-us/openjdk/8/html/using_openjdk_8_source-to-image_for_openshift/index");
129+
Assertions.assertThat(metadata.labels().get("usage")).isEqualTo("https://jboss-container-images.github.io/openjdk/");
130130
} else if (OpenJDKTestConfig.isOpenJDK11()){
131-
Assertions.assertThat(metadata.labels().get("usage")).isEqualTo("https://access.redhat.com/documentation/en-us/openjdk/11/html/using_openjdk_11_source-to-image_for_openshift/index");
131+
Assertions.assertThat(metadata.labels().get("usage")).isEqualTo("https://jboss-container-images.github.io/openjdk/");
132132
} else if (OpenJDKTestConfig.isOpenJDK17()){
133+
Assertions.assertThat(metadata.labels().get("usage")).isEqualTo("https://jboss-container-images.github.io/openjdk/");
134+
} else if (OpenJDKTestConfig.isRHEL9() && OpenJDKTestConfig.isOpenJDK21()){ //Temp fix until https://issues.redhat.com/browse/OPENJDK-2595
133135
Assertions.assertThat(metadata.labels().get("usage")).isEqualTo("https://access.redhat.com/documentation/en-us/red_hat_jboss_middleware_for_openshift/3/html/red_hat_java_s2i_for_openshift/");
136+
} else if (OpenJDKTestConfig.isOpenJDK21()){
137+
Assertions.assertThat(metadata.labels().get("usage")).isEqualTo("https://jboss-container-images.github.io/openjdk/");
134138
}
135139

136140
}
@@ -142,7 +146,7 @@ public void testUrandomJavaSecurity() {
142146
result = content.shell().execute("cat", "/usr/lib/jvm/java/jre/lib/security/java.security").getOutput();
143147
} else if (OpenJDKTestConfig.isOpenJDK11()){
144148
result = content.shell().execute("cat", "/usr/lib/jvm/jre/conf/security/java.security").getOutput();
145-
} else if (OpenJDKTestConfig.isOpenJDK17()){
149+
} else if (OpenJDKTestConfig.isOpenJDK17() || OpenJDKTestConfig.isOpenJDK21()) {
146150
result = content.shell().execute("cat", "/usr/lib/jvm/jre/conf/security/java.security").getOutput();
147151
}
148152

@@ -154,16 +158,24 @@ public void testUrandomJavaSecurity() {
154158
@Test
155159
public void javaUtilitiesTest() {
156160
//Content should match what is in the java/bin folder. Or the $JAVA_HOME/bin folder
161+
// JDK 8 for UBI 8 and Rhel 7
157162
if ( OpenJDKTestConfig.isOpenJDK8() || OpenJDKTestConfig.isOpenJDK8Rhel7() ) {
158163
LOGGER.info("DockerImageTest:javaUtilitiesTest::Running check for jdk8.");
159164
Assertions.assertThat(content.listDirContent("$JAVA_HOME/bin")).contains(super.DEFAULT_JAVA_8_UTILITIES);
165+
// JDK 11 for Rhel 7, UBI 8, UBI 9
160166
} else if (OpenJDKTestConfig.isOpenJDK11()){
161167
LOGGER.info("DockerImageTest:javaUtilitiesTest::Running check for jdk11.");
162168
Assertions.assertThat(content.listDirContent("$JAVA_HOME/bin")).contains(super.DEFAULT_JAVA_11_UTILITIES);
169+
// JDK 17 for UBI 8 and UBI 9
163170
} else if (OpenJDKTestConfig.isOpenJDK17()){
164171
LOGGER.info("DockerImageTest:javaUtilitiesTest::Running check for jdk17");
165172
Assertions.assertThat(content.listDirContent("$JAVA_HOME/bin")).contains(super.DEFAULT_JAVA_17_UTILITIES);
166173
}
174+
// JDK 21 for UBI 8 and UBI 9
175+
else if (OpenJDKTestConfig.isOpenJDK21()){
176+
LOGGER.info("DockerImageTest:javaUtilitiesTest::Running check for jdk21");
177+
Assertions.assertThat(content.listDirContent("$JAVA_HOME/bin")).contains(super.DEFAULT_JAVA_21_UTILITIES);
178+
}
167179
else {
168180
LOGGER.info("DockerImageTest:javaUtilitiesTest::Error, jdk version not supported. Please check jdk container image.");
169181
super.javaUtilitiesTest();
@@ -186,16 +198,19 @@ private static Map<String, String> getExpectedEnvironments() {
186198
} else {
187199
result.put("HOME", "/home/jboss");
188200
}
189-
190-
if (OpenJDKTestConfig.isOpenJ9()) {
191-
result.put("JAVA_HOME", OpenJDKTestConfig.isOpenJDK11() ? "/usr/lib/jvm/jre-11-openj9" : "/usr/lib/jvm/jre-1.8.0-openj9");
201+
// Supported versions of OpenJDK 8,11, 17, 21
202+
if (OpenJDKTestConfig.isOpenJDK21()) {
203+
result.put("JAVA_HOME", "/usr/lib/jvm/java-21");
192204
} else if (OpenJDKTestConfig.isOpenJDK17()) {
193205
result.put("JAVA_HOME", "/usr/lib/jvm/java-17");
194206
} else {
195207
result.put("JAVA_HOME", OpenJDKTestConfig.isOpenJDK11() ? "/usr/lib/jvm/java-11" : "/usr/lib/jvm/java-1.8.0");
196208
}
197209
result.put("JAVA_VENDOR", OpenJDKTestConfig.isOpenJ9() ? "AdoptOpenJDK" : "openjdk");
198-
if (OpenJDKTestConfig.isOpenJDK17()) {
210+
211+
if (OpenJDKTestConfig.isOpenJDK21()) {
212+
result.put("JAVA_VERSION", "21");
213+
} else if (OpenJDKTestConfig.isOpenJDK17()) {
199214
result.put("JAVA_VERSION", "17");
200215
} else {
201216
result.put("JAVA_VERSION", OpenJDKTestConfig.isOpenJDK11() ? "11" : "1.8.0");

test-openjdk/src/test/java/com/redhat/qe/openjdk/maven/MavenJavaArgsTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ public void javaClassPathTest() {
180180
@Test
181181
public void javaDiagnosticsTest() {
182182
deploy(JavaS2IBuild.DOCKER_IMAGE_TEST_APP.getManagedBuild(), Collections.singletonMap("JAVA_DIAGNOSTICS", "true"));
183-
if (OpenJDKTestConfig.isOpenJDK17()) {
183+
if ( OpenJDKTestConfig.isOpenJDK21() ||OpenJDKTestConfig.isOpenJDK17()) {
184184
Assertions.assertThat(getJavaOpts())
185185
.containsOnlyOnce("-XX:NativeMemoryTracking=summary")
186186
.containsOnlyOnce("-Xlog:gc::utctime");

0 commit comments

Comments
 (0)