Skip to content

Commit f50d4a0

Browse files
rdnovellRuben Novelli
authored andcommitted
Sync files /jdk21 builder-image
1 parent 6d28d14 commit f50d4a0

File tree

27 files changed

+1118
-1
lines changed

27 files changed

+1118
-1
lines changed

container-images/jdk21/builder-image/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@
307307
IMAGE_VERSION="1.0.0.Beta" \
308308
PROVISIONING_MAVEN_PLUGIN_ARTIFACT_ID="eap-maven-plugin" \
309309
PROVISIONING_MAVEN_PLUGIN_GROUP_ID="org.jboss.eap.plugins" \
310-
PROVISIONING_MAVEN_PLUGIN_VERSION="2.0.0.Beta1-redhat-00002" \
310+
PROVISIONING_MAVEN_PLUGIN_VERSION="2.0.0.Beta1-redhat-00004" \
311311
SSO_DEFAULT_PROVIDER_NAME="rh-sso"
312312
# Set 'jboss-eap-8-tech-preview/eap81-openjdk21-builder-openshift-rhel9' image defined labels
313313
LABEL \
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
@ubi9
2+
Feature: Openshift OpenJDK GC tests
3+
4+
Scenario: Check default GC configuration
5+
Given container is started as uid 1000
6+
Then container log should contain -XX:+UseParallelGC
7+
And container log should contain -XX:MinHeapFreeRatio=10
8+
And container log should contain -XX:MaxHeapFreeRatio=20
9+
And container log should contain -XX:GCTimeRatio=4
10+
11+
Scenario: Check GC_MIN_HEAP_FREE_RATIO GC configuration
12+
Given container is started with env
13+
| variable | value |
14+
| GC_MIN_HEAP_FREE_RATIO | 5 |
15+
Then container log should contain -XX:MinHeapFreeRatio=5
16+
17+
Scenario: Check GC_MAX_HEAP_FREE_RATIO GC configuration
18+
Given container is started with env
19+
| variable | value |
20+
| GC_MAX_HEAP_FREE_RATIO | 50 |
21+
Then container log should contain -XX:MaxHeapFreeRatio=50
22+
23+
Scenario: Check GC_TIME_RATIO GC configuration
24+
Given container is started with env
25+
| variable | value |
26+
| GC_TIME_RATIO | 5 |
27+
Then container log should contain -XX:GCTimeRatio=5
28+
29+
Scenario: Check GC_ADAPTIVE_SIZE_POLICY_WEIGHT GC configuration
30+
Given container is started with env
31+
| variable | value |
32+
| GC_ADAPTIVE_SIZE_POLICY_WEIGHT | 80 |
33+
Then container log should contain -XX:AdaptiveSizePolicyWeight=80
34+
35+
Scenario: Check GC_MAX_METASPACE_SIZE GC configuration
36+
Given container is started with env
37+
| variable | value |
38+
| GC_MAX_METASPACE_SIZE | 120 |
39+
Then container log should contain -XX:MaxMetaspaceSize=120m
40+
41+
Scenario: Check GC_CONTAINER_OPTIONS configuration
42+
Given container is started with env
43+
| variable | value |
44+
| GC_CONTAINER_OPTIONS | -XX:+UseG1GC |
45+
Then container log should contain -XX:+UseG1GC
46+
And container log should not contain -XX:+UseParallelGC
47+
48+
Scenario: Check GC_METASPACE_SIZE GC configuration
49+
Given container is started with env
50+
| variable | value |
51+
| GC_METASPACE_SIZE | 120 |
52+
Then container log should contain -XX:MetaspaceSize=120m
53+
And container log should not contain integer expression expected
54+
55+
Scenario: Check GC_METASPACE_SIZE constrained by GC_MAX_METASPACE_SIZE GC configuration
56+
Given container is started with env
57+
| variable | value |
58+
| GC_METASPACE_SIZE | 120 |
59+
| GC_MAX_METASPACE_SIZE | 90 |
60+
Then container log should contain -XX:MaxMetaspaceSize=90m
61+
And container log should contain -XX:MetaspaceSize=90m
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
Feature: OPENJDK-559 JVM Memory tests
2+
3+
@ubi9
4+
Scenario: Check default JVM max heap configuration
5+
Given container is started as uid 1000
6+
Then container log should contain -XX:MaxRAMPercentage=80.0
7+
8+
@ubi9
9+
Scenario: Check configured JVM max heap configuration and ensure JAVA_MAX_MEM_RATIO accepts floats but only takes whole number part
10+
Given container is started with env
11+
| variable | value |
12+
| JAVA_MAX_MEM_RATIO | 90.4 |
13+
Then container log should contain -XX:MaxRAMPercentage=90.0
14+
15+
@ubi9
16+
Scenario: Ensure JAVA_MAX_MEM_RATIO accepts Integers
17+
Given container is started with env
18+
| variable | value |
19+
| JAVA_MAX_MEM_RATIO | 90 |
20+
Then container log should contain -XX:MaxRAMPercentage=90.0
21+
22+
@ubi9
23+
Scenario: Ensure JAVA_MAX_MEM_RATIO=0 disables parameter
24+
Given container is started with env
25+
| variable | value |
26+
| JAVA_MAX_MEM_RATIO | 0 |
27+
Then container log should not contain -XX:MaxRAMPercentage
28+
29+
@ubi9
30+
Scenario: Check default JVM initial heap configuration is unspecified
31+
Given container is started as uid 1000
32+
Then container log should not contain -XX:InitialRAMPercentage
33+
And container log should not contain -Xms
34+
35+
# Not the runtime images
36+
@ubi9/openjdk-11
37+
@ubi9/openjdk-17
38+
@ubi9/openjdk-21
39+
Scenario: Ensure Maven doesn't use MaxRAMPercentage=80
40+
Given s2i build https://github.com/rh-openjdk/openjdk-container-test-applications.git from spring-boot-sample-simple
41+
Then s2i build log should match regex INFO Using MAVEN_OPTS.*-XX:MaxRAMPercentage=25.0$
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
@ubi9/openjdk-11
2+
@ubi9/openjdk-17
3+
@ubi9/openjdk-21
4+
Feature: Openshift OpenJDK Runtime tests
5+
6+
@ubi9
7+
Scenario: Check JAVA_OPTS overrides defaults
8+
Given container is started with env
9+
| variable | value |
10+
| JAVA_OPTS | --show-version |
11+
Then container log should not contain -XX:MaxRAMPercentage
12+
13+
@ubi9
14+
Scenario: Check empty JAVA_OPTS overrides defaults
15+
Given container is started with env
16+
| variable | value |
17+
| JAVA_OPTS | |
18+
Then container log should not contain -XX:MaxRAMPercentage
19+
20+
@ubi9
21+
Scenario: Check JAVA_OPTS overrides JAVA_OPTS_APPEND
22+
Given container is started with env
23+
| variable | value |
24+
| JAVA_OPTS | -verbose:gc |
25+
| JAVA_OPTS_APPEND | -Xint |
26+
Then container log should contain -verbose:gc
27+
And container log should not contain -Xint
28+
29+
@ubi9
30+
Scenario: Check JAVA_APP_NAME can contain spaces (OPENJDK-1551)
31+
Given container is started with env
32+
| variable | value |
33+
| JAVA_APP_NAME | foo bar |
34+
Then container log should not contain exec: bar': not found
35+
36+
@ubi9
37+
Scenario: Check default JAVA_APP_DIR (OPENJDK-2034)
38+
When container is ready
39+
Then available container log should contain INFO running in /deployments
40+
41+
@ubi9
42+
Scenario: Check custom JAVA_APP_DIR (OPENJDK-2034)
43+
Given container is started with env
44+
| variable | value |
45+
| JAVA_APP_DIR | /home/default |
46+
Then available container log should contain INFO running in /home/default
47+
48+
@ubi9
49+
Scenario: Check relative path JAVA_APP_DIR (OPENJDK-2034)
50+
Given container is started with env
51+
| variable | value |
52+
| JAVA_APP_DIR | . |
53+
Then available container log should contain INFO running in /home/default
54+
55+
# temporarily disabled, see https://issues.redhat.com/browse/OPENJDK-3536
56+
@ignore
57+
Scenario: Check non-existent path JAVA_APP_DIR (OPENJDK-2034)
58+
Given container is started with env
59+
| variable | value |
60+
| JAVA_APP_DIR | /nope |
61+
Then available container log should contain ERROR No directory /nope found for auto detection
62+
63+
# Builder images only
64+
Scenario: Ensure JAVA_APP_DIR and S2I work together (OPENJDK-2034)
65+
Given s2i build https://github.com/rh-openjdk/openjdk-container-test-applications.git from undertow-servlet
66+
| variable | value |
67+
| JAVA_APP_DIR | /home/default |
68+
| S2I_TARGET_DEPLOYMENTS_DIR | /home/default |
69+
Then container log should contain /home/default/undertow-servlet.jar
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#!/usr/bin/env bats
2+
load common
3+
4+
@test "_add_maven_repo_profile: Should use the parameters provided and defaults for the rest" {
5+
run _add_maven_repo_profile $SETTINGS my_id http://my_url:8080
6+
assert_profile_xml "my_id-profile" "profile_default.xml"
7+
assert_active_profile "my_id-profile"
8+
}
9+
10+
@test "_add_maven_repo_profile: Should use the parameters provided and defaults for the rest using prefix" {
11+
run _add_maven_repo_profile $SETTINGS my_id http://my_url:8080 "TEST_1"
12+
assert_profile_xml "my_id-profile" "profile_default.xml"
13+
assert_active_profile "my_id-profile"
14+
}
15+
16+
@test "_add_maven_repo_profile: Should use all the parameters provided. No prefix" {
17+
REPO_LAYOUT="other_layout"
18+
REPO_RELEASES_ENABLED="false"
19+
REPO_RELEASES_UPDATE_POLICY="never"
20+
REPO_SNAPSHOTS_ENABLED="other_false"
21+
REPO_SNAPSHOTS_UPDATE_POLICY="other_never"
22+
REPO_SNAPSHOTS_CHECKSUM_POLICY="other_fail"
23+
24+
run _add_maven_repo_profile $SETTINGS my_id http://my_url:8080
25+
assert_profile_xml "my_id-profile" "profile_all_vars.xml"
26+
assert_active_profile "my_id-profile"
27+
}
28+
29+
@test "_add_maven_repo_profile: Should use all the parameters provided. Empty prefix" {
30+
REPO_LAYOUT="other_layout"
31+
REPO_RELEASES_ENABLED="false"
32+
REPO_RELEASES_UPDATE_POLICY="never"
33+
REPO_SNAPSHOTS_ENABLED="other_false"
34+
REPO_SNAPSHOTS_UPDATE_POLICY="other_never"
35+
REPO_SNAPSHOTS_CHECKSUM_POLICY="other_fail"
36+
37+
run _add_maven_repo_profile $SETTINGS my_id http://my_url:8080
38+
assert_profile_xml "my_id-profile" "profile_all_vars.xml"
39+
assert_active_profile "my_id-profile"
40+
}
41+
42+
@test "_add_maven_repo_profile: Should use all the parameters provided. Use prefix" {
43+
TEST_1_REPO_LAYOUT="other_layout"
44+
TEST_1_REPO_RELEASES_ENABLED="false"
45+
TEST_1_REPO_RELEASES_UPDATE_POLICY="never"
46+
TEST_1_REPO_SNAPSHOTS_ENABLED="other_false"
47+
TEST_1_REPO_SNAPSHOTS_UPDATE_POLICY="other_never"
48+
TEST_1_REPO_SNAPSHOTS_CHECKSUM_POLICY="other_fail"
49+
50+
run _add_maven_repo_profile $SETTINGS my_id http://my_url:8080 "TEST_1"
51+
assert_profile_xml "my_id-profile" "profile_all_vars.xml"
52+
assert_active_profile "my_id-profile"
53+
}
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
#!/usr/bin/env bats
2+
load common
3+
4+
@test "_add_maven_repo_server: Should set only the ID." {
5+
run _add_maven_repo_server $SETTINGS "my_id"
6+
assert_server_xml "my_id" "server.xml"
7+
}
8+
9+
@test "_add_maven_repo_server: Should not set the username and password. Missing username" {
10+
REPO_PASSWORD="thefrog"
11+
12+
run _add_maven_repo_server $SETTINGS "my_id"
13+
assert_server_xml "my_id" "server.xml"
14+
}
15+
16+
@test "_add_maven_repo_server: Should not set the username and password. Missing password" {
17+
REPO_USERNAME="kermit"
18+
19+
run _add_maven_repo_server $SETTINGS "my_id"
20+
assert_server_xml "my_id" "server.xml"
21+
}
22+
23+
@test "_add_maven_repo_server: Should set the username and password." {
24+
REPO_USERNAME="kermit"
25+
REPO_PASSWORD="thefrog"
26+
27+
run _add_maven_repo_server $SETTINGS "my_id"
28+
assert_server_xml "my_id" "server_with_username.xml"
29+
}
30+
31+
@test "_add_maven_repo_server: Should not set the private key and passphrase. Missing private key" {
32+
REPO_PASSPHRASE="mypassphrase"
33+
34+
run _add_maven_repo_server $SETTINGS "my_id"
35+
assert_server_xml "my_id" "server.xml"
36+
}
37+
38+
@test "_add_maven_repo_server: Should not set the private key and passphrase. Missing passphrase" {
39+
REPO_PRIVATE_KEY="myprivatekey"
40+
41+
run _add_maven_repo_server $SETTINGS "my_id"
42+
assert_server_xml "my_id" "server.xml"
43+
}
44+
45+
@test "_add_maven_repo_server: Should set the private key and passphrase" {
46+
REPO_PRIVATE_KEY="myprivatekey"
47+
REPO_PASSPHRASE="mypassphrase"
48+
49+
run _add_maven_repo_server $SETTINGS "my_id"
50+
assert_server_xml "my_id" "server_with_privatekey.xml"
51+
}
52+
53+
@test "_add_maven_repo_server: Should use all the parameters provided. No prefix" {
54+
REPO_USERNAME="kermit"
55+
REPO_PASSWORD="thefrog"
56+
REPO_PRIVATE_KEY="myprivatekey"
57+
REPO_PASSPHRASE="mypassphrase"
58+
59+
run _add_maven_repo_server $SETTINGS "my_id"
60+
assert_server_xml "my_id" "server_with_all.xml"
61+
}
62+
63+
@test "_add_maven_repo_server: Should use all the parameters provided. Empty prefix" {
64+
REPO_USERNAME="kermit"
65+
REPO_PASSWORD="thefrog"
66+
REPO_PRIVATE_KEY="myprivatekey"
67+
REPO_PASSPHRASE="mypassphrase"
68+
69+
run _add_maven_repo_server $SETTINGS "my_id" ""
70+
assert_server_xml "my_id" "server_with_all.xml"
71+
}
72+
73+
@test "_add_maven_repo_server: Should use all the parameters provided. Use prefix" {
74+
TEST_REPO_USERNAME="kermit"
75+
TEST_REPO_PASSWORD="thefrog"
76+
TEST_REPO_PRIVATE_KEY="myprivatekey"
77+
TEST_REPO_PASSPHRASE="mypassphrase"
78+
79+
run _add_maven_repo_server $SETTINGS "my_id" "TEST"
80+
assert_server_xml "my_id" "server_with_all.xml"
81+
}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
CCT_MODULE_DIR="${BATS_TEST_DIRNAME}/../../../../../../.."
2+
3+
load $CCT_MODULE_DIR/tests/bats/common/xml_utils.bash
4+
5+
export JBOSS_HOME=$BATS_TMPDIR/jboss_home
6+
mkdir -p $JBOSS_HOME/bin/launch
7+
cp $CCT_MODULE_DIR/os-eap7-launch/added/launch/launch-common.sh $JBOSS_HOME/bin/launch
8+
cp $CCT_MODULE_DIR/jboss/container/util/logging/artifacts/opt/jboss/container/util/logging/logging.sh $JBOSS_HOME/bin/launch
9+
10+
export HOME=$BATS_TMPDIR/home
11+
export SETTINGS=$HOME/.m2/settings.xml
12+
export JBOSS_CONTAINER_UTIL_LOGGING_MODULE=$CCT_MODULE_DIR/jboss/container/util/logging/artifacts/opt/jboss/container/util/logging
13+
14+
mkdir -p $HOME/.m2
15+
16+
source $CCT_MODULE_DIR/jboss/container/maven/default/artifacts/opt/jboss/container/maven/default/maven.sh
17+
18+
setup() {
19+
cp $CCT_MODULE_DIR/jboss/container/maven/default/artifacts/opt/jboss/container/maven/default/jboss-settings.xml $HOME/.m2/settings.xml
20+
}
21+
22+
function assert_profile_xml() {
23+
local profile_id=$1
24+
local expected=$2
25+
local xpath='//*[local-name()="profile"][*[local-name()="id"]="'$profile_id'"]'
26+
27+
assert_xml $HOME/.m2/settings.xml $xpath $BATS_TEST_DIRNAME/expectations/$expected
28+
}
29+
30+
function has_generated_profile() {
31+
local xpath='//*[local-name()="profile"][starts-with(*[local-name()="id"],"repo-")]/*[local-name()="id"]/text()'
32+
33+
assert_xml_value $HOME/.m2/settings.xml $xpath '^repo-.*-profile$'
34+
}
35+
36+
function assert_active_profile() {
37+
local profile_id=$1
38+
local xpath='//*[local-name()="activeProfile"][text()="'$profile_id'"]/text()'
39+
40+
assert_xml_value $HOME/.m2/settings.xml $xpath $profile_id
41+
}
42+
43+
function has_generated_active_profile() {
44+
local xpath='//*[local-name()="activeProfile"][starts-with(.,"repo-")]/text()'
45+
46+
assert_xml_value $HOME/.m2/settings.xml $xpath '^repo-.*-profile$'
47+
}
48+
49+
function assert_server_xml() {
50+
local profile_id=$1
51+
local expected=$2
52+
local xpath='//*[local-name()="server"][*[local-name()="id"]="'$profile_id'"]'
53+
54+
assert_xml $HOME/.m2/settings.xml $xpath $BATS_TEST_DIRNAME/expectations/$expected
55+
}
56+
57+
function has_generated_server() {
58+
local profile_regex=$1
59+
local xpath='//*[local-name()="server"][starts-with(*[local-name()="id"],"repo-")]/*[local-name()="id"]/text()'
60+
61+
assert_xml_value $HOME/.m2/settings.xml $xpath '^repo-.*$'
62+
}

0 commit comments

Comments
 (0)