-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial import of Red Hat's OpenJDK OCP testsuite to GitHub.
- Loading branch information
0 parents
commit 6ea1164
Showing
98 changed files
with
6,102 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# Maven | ||
target | ||
# Maven keycloak.js changes for "war-app-html5" and "war-app-profile-html5" example applications | ||
test-sso/src/test/resources/apps/war-app-html5/src/main/webapp/keycloak.js | ||
test-sso/src/test/resources/apps/war-app-profile-html5/src/main/webapp/keycloak.js | ||
|
||
# Eclipse | ||
.settings | ||
.classpath | ||
.project | ||
|
||
# temp files | ||
log | ||
tmp | ||
log.txt | ||
*.log | ||
|
||
# vim | ||
.*.swp | ||
|
||
# Intellij | ||
.idea/ | ||
*.iml | ||
*.iws | ||
|
||
# Test properties | ||
test.properties | ||
|
||
# Properties used in runtime | ||
used-test.properties | ||
|
||
# Images used in runtime | ||
used-images.properties | ||
|
||
# Templates used for tests | ||
used-templates.properties | ||
|
||
# Usage report | ||
usage.json | ||
|
||
# Indy | ||
infra/maven-cache/indy | ||
|
||
# Ansible | ||
*.retry |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
/* | ||
* Copyright 2007-present the original author or authors. | ||
* | ||
* 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. | ||
*/ | ||
import java.net.*; | ||
import java.io.*; | ||
import java.nio.channels.*; | ||
import java.util.Properties; | ||
|
||
public class MavenWrapperDownloader { | ||
|
||
private static final String WRAPPER_VERSION = "0.5.5"; | ||
/** | ||
* Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. | ||
*/ | ||
private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/" | ||
+ WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar"; | ||
|
||
/** | ||
* Path to the maven-wrapper.properties file, which might contain a downloadUrl property to | ||
* use instead of the default one. | ||
*/ | ||
private static final String MAVEN_WRAPPER_PROPERTIES_PATH = | ||
".mvn/wrapper/maven-wrapper.properties"; | ||
|
||
/** | ||
* Path where the maven-wrapper.jar will be saved to. | ||
*/ | ||
private static final String MAVEN_WRAPPER_JAR_PATH = | ||
".mvn/wrapper/maven-wrapper.jar"; | ||
|
||
/** | ||
* Name of the property which should be used to override the default download url for the wrapper. | ||
*/ | ||
private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; | ||
|
||
public static void main(String args[]) { | ||
System.out.println("- Downloader started"); | ||
File baseDirectory = new File(args[0]); | ||
System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); | ||
|
||
// If the maven-wrapper.properties exists, read it and check if it contains a custom | ||
// wrapperUrl parameter. | ||
File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); | ||
String url = DEFAULT_DOWNLOAD_URL; | ||
if(mavenWrapperPropertyFile.exists()) { | ||
FileInputStream mavenWrapperPropertyFileInputStream = null; | ||
try { | ||
mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); | ||
Properties mavenWrapperProperties = new Properties(); | ||
mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); | ||
url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); | ||
} catch (IOException e) { | ||
System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); | ||
} finally { | ||
try { | ||
if(mavenWrapperPropertyFileInputStream != null) { | ||
mavenWrapperPropertyFileInputStream.close(); | ||
} | ||
} catch (IOException e) { | ||
// Ignore ... | ||
} | ||
} | ||
} | ||
System.out.println("- Downloading from: " + url); | ||
|
||
File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); | ||
if(!outputFile.getParentFile().exists()) { | ||
if(!outputFile.getParentFile().mkdirs()) { | ||
System.out.println( | ||
"- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'"); | ||
} | ||
} | ||
System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); | ||
try { | ||
downloadFileFromURL(url, outputFile); | ||
System.out.println("Done"); | ||
System.exit(0); | ||
} catch (Throwable e) { | ||
System.out.println("- Error downloading"); | ||
e.printStackTrace(); | ||
System.exit(1); | ||
} | ||
} | ||
|
||
private static void downloadFileFromURL(String urlString, File destination) throws Exception { | ||
if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) { | ||
String username = System.getenv("MVNW_USERNAME"); | ||
char[] password = System.getenv("MVNW_PASSWORD").toCharArray(); | ||
Authenticator.setDefault(new Authenticator() { | ||
@Override | ||
protected PasswordAuthentication getPasswordAuthentication() { | ||
return new PasswordAuthentication(username, password); | ||
} | ||
}); | ||
} | ||
URL website = new URL(urlString); | ||
ReadableByteChannel rbc; | ||
rbc = Channels.newChannel(website.openStream()); | ||
FileOutputStream fos = new FileOutputStream(destination); | ||
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); | ||
fos.close(); | ||
rbc.close(); | ||
} | ||
|
||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.1/apache-maven-3.6.1-bin.zip | ||
wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2018, 2020 ocp-openjdk-test authors | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
# 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](https://catalog.redhat.com/software/containers/redhat-openjdk-18/openjdk18-openshift/58ada5701fbe981673cd6b10) | | ||
| Rhel 7 | 11 | [openjdk-11-rhel7](https://catalog.redhat.com/software/containers/openjdk/openjdk-11-rhel7/5bf57185dd19c775cddc4ce5) | | ||
| UBI 8 | 8 | [openjdk-8](https://catalog.redhat.com/software/containers/ubi8/openjdk-8/5dd6a48dbed8bd164a09589a) | | ||
| UBI 8 | 11 | [openjdk-11](https://catalog.redhat.com/software/containers/ubi8/openjdk-11/5dd6a4b45a13461646f677f4) | | ||
| UBI 8 | 17 | [openjdk-17](https://catalog.redhat.com/software/containers/ubi8/openjdk-17/618bdbf34ae3739687568813) | | ||
| UBI 9 | 11 | [openjdk-11](https://catalog.redhat.com/software/containers/ubi9/openjdk-11/61ee7bafed74b2ffb22b07ab) | | ||
| UBI 9 | 17 | [openjdk-17](https://catalog.redhat.com/software/containers/ubi9/openjdk-17/61ee7c26ed74b2ffb22b07f6) | | ||
**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/` | ||
|
||
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 | ||
bash run.sh --jdk-version=8 | ||
bash run.sh --jdk-version=11 | ||
bash run.sh --jdk-version=17 | ||
``` | ||
|
||
## 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. | ||
|
||
```yaml | ||
#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 | ||
``` yaml | ||
#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 | ||
|
||
``` | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
############################################# | ||
###### Image Definition with XTF core ####### | ||
############################################# | ||
|
||
# UBI 8 (Rhel 8) version of the container | ||
xtf.openjdk.8.image=registry.access.redhat.com/ubi8/openjdk-8:1.17-1.1693366248 | ||
xtf.openjdk.8.version=1.8.0 | ||
|
||
# UBI 8 (Rhel 8) version of the container | ||
xtf.openjdk.11.image=registry.access.redhat.com/ubi8/openjdk-11:1.17-1.1693366250 | ||
xtf.openjdk.11.version=11 | ||
|
||
#JDK 17 image reference | ||
xtf.openjdk.17.image=registry.access.redhat.com/ubi8/openjdk-17:1.17-1.1693366272 | ||
xtf.openjdk.17.version=17 | ||
|
||
############################################# | ||
xtf.openshift.namespace=jdk | ||
xtf.bm.namespace=jdk-build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
apiVersion: "v1" | ||
kind: "LimitRange" | ||
metadata: | ||
name: "openjdk-qe-default-limits" | ||
spec: | ||
limits: | ||
- type: Container | ||
default: | ||
cpu: "2" | ||
memory: 512Mi | ||
defaultRequest: | ||
cpu: "1" | ||
memory: 256Mi |
Oops, something went wrong.