Skip to content

Testing for Red Hat's OpenJDK builds against Red Hat OpenShift Container Platform

License

Notifications You must be signed in to change notification settings

rh-openjdk/jdkContainerOcpTests

Repository files navigation

Red Hat OpenJDK OpenShift Container Platform(OCP) Test Suite


This test suite is designed to be executed against current versions of Red Hat's OpenJDK containers.

Operating System version OpenJDK Version Link to Container
Rhel 7 8 openjdk18-openshift
Rhel 7 11 openjdk-11-rhel7
UBI 8 8 openjdk-8
UBI 8 11 openjdk-11
UBI 8 17 openjdk-17
UBI 8 21 openjdk-21
UBI 9 11 openjdk-11
UBI 9 17 openjdk-17
UBI 9 21 openjdk-21
Note: OpenJDK runtime images are not currently supported by this test suite.

This test suite is based on the XTF project [https://github.com/xtf-cz/xtf] that leverages JUnit 5, Fabric8 Kubernetes Client [https://github.com/fabric8io/kubernetes-client/] and other useful libraries to unify and simplify interactions with OpenShift.


Test Execution

Use mvn clean to remove existing test artifacts from your sandbox.

To execute the UBI 8 or UBI 9 images you must create a (Limit Range) [https://docs.openshift.com/container-platform/4.13/nodes/clusters/nodes-cluster-limit-ranges.html]] To execute the test suite by hand against a defined version of Red Hat's OpenJDK containers issue the following command.

  • MAVEN_HOME=/usr/bin/ mvn clean test -P 8 -P smoke -Dmaven.home=/usr/bin/
  • MAVEN_HOME=/usr/bin/ mvn clean test -P 11 -P smoke -Dmaven.home=/usr/bin/
  • MAVEN_HOME=/usr/bin/ mvn clean test -P 17 -P smoke -Dmaven.home=/usr/bin/
  • MAVEN_HOME=/usr/bin/ mvn clean test -P 21 -P smoke -Dmaven.home=/usr/bin/

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.

For UBI 8 and UBI 9 images it is recommended to use the bash script for the execution of the testsuite. The bash script will create the OCP projects as defined in the global-test.properties and then create a limit-range resource as defined by the limit_range.yaml file.

bash run.sh --jdk-version=8
bash run.sh --jdk-version=11
bash run.sh --jdk-version=17
bash run.sh --jdk-version=21

Configuration

To configure the test suite for execution against the OpenJDK Image Under Test (IUT) you must have the following.

  1. An execution node that can execute a Maven-based Java application.
  2. A running instance of Red Hat's OpenShift Container Platform(OCP) with admin access.

Configure the global-test.properties to describe your environment as well as two OCP projects that the test suite runs against.

#mocked settings
xtf.openshift.namespace=<project_name>
xtf.bm.namespace=<build_project_name>
xtf.openshift.url=<result from 'oc whoami --show-server'>
xtf.openshift.token=<result from 'oc whoami -t'>
xtf.openshift.admin.token=<result from 'oc whoami -t'>

Token auth

#past example 
xtf.openshift.url=https://api.servername:6443
xtf.openshift.token=sha256~lfGBHTDiL1PxVZrM3wMvnU_bvgZyJhZLsb_iU_Zrhwk
xtf.openshift.admin.token=sha256~lfGBHTDiL1PxVZrM3wMvnU_bvgZyJhZLsb_iU_Zrhwk
xtf.openshift.namespace=alpha
xtf.bm.namespace=alpha-builds

A simplier approach to authetication and execution is to export the kubeconfig file then execute the test suite.

#mocked config 
export KUBECONFIG=<path_to_kubeconfig>
#past example
export KUBECONFIG=kubeconfig

After this is done then it is just a matter of executing the testsuite as already defined above.

About

Testing for Red Hat's OpenJDK builds against Red Hat OpenShift Container Platform

Resources

License

Stars

Watchers

Forks

Packages

No packages published