Skip to content

Commit 6ec6f59

Browse files
rdnovellRuben Novelli
authored andcommitted
Sync files /jdk21 runtime-image
1 parent 58bfbf3 commit 6ec6f59

File tree

5 files changed

+353
-0
lines changed

5 files changed

+353
-0
lines changed
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: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
Feature: Miscellaneous OpenJDK-related unit tests
2+
3+
@ubi9/openjdk-11
4+
@ubi9/openjdk-11-runtime
5+
Scenario: Check that only OpenJDK 11 is installed
6+
When container is started with args
7+
| arg | value |
8+
| command | rpm -qa |
9+
Then available container log should not contain java-1.8.0
10+
Then available container log should not contain java-17
11+
Then available container log should not contain java-21
12+
13+
@ubi9/openjdk-17
14+
@ubi9/openjdk-17-runtime
15+
Scenario: Check that only OpenJDK 17 is installed
16+
When container is started with args
17+
| arg | value |
18+
| command | rpm -qa |
19+
Then available container log should not contain java-1.8.0
20+
Then available container log should not contain java-11
21+
Then available container log should not contain java-21
22+
23+
@ubi9/openjdk-21
24+
@ubi9/openjdk-21-runtime
25+
Scenario: Check that only OpenJDK 21 is installed
26+
When container is started with args
27+
| arg | value |
28+
| command | rpm -qa |
29+
Then available container log should not contain java-1.8.0
30+
Then available container log should not contain java-11
31+
Then available container log should not contain java-17
32+
33+
@ubi9
34+
Scenario: Ensure JAVA_HOME is defined and contains Java
35+
When container is started with args
36+
| arg | value |
37+
| command | bash -c "$JAVA_HOME/bin/java -version" |
38+
Then available container log should contain OpenJDK Runtime Environment
39+
40+
@ubi9
41+
Scenario: Check that certain non-UBI packages are not installed
42+
When container is started with args
43+
| arg | value |
44+
| command | rpm -qa |
45+
Then available container log should not contain grub
46+
Then available container log should not contain os-prober
47+
Then available container log should not contain rpm-plugin-systemd-inhibit
48+
49+
@ubi9/openjdk-11
50+
@ubi9/openjdk-11-runtime
51+
Scenario: Check that directories from other JDKs are not present (JDK11)
52+
When container is started with args
53+
| arg | value |
54+
| command | ls -1 /usr/lib/jvm |
55+
Then available container log should not contain java-1.8.0
56+
Then available container log should not contain java-17
57+
Then available container log should not contain java-21
58+
59+
@ubi9/openjdk-17
60+
@ubi9/openjdk-17-runtime
61+
Scenario: Check that directories from other JDKs are not present (JDK17)
62+
When container is started with args
63+
| arg | value |
64+
| command | ls -1 /usr/lib/jvm |
65+
Then available container log should not contain java-1.8.0
66+
Then available container log should not contain java-11
67+
Then available container log should not contain java-21
68+
69+
@ubi9/openjdk-21
70+
@ubi9/openjdk-21-runtime
71+
Scenario: Check that directories from other JDKs are not present (JDK21)
72+
When container is started with args
73+
| arg | value |
74+
| command | ls -1 /usr/lib/jvm |
75+
Then available container log should not contain java-1.8.0
76+
Then available container log should not contain java-11
77+
Then available container log should not contain java-17
78+
79+
@ubi9
80+
Scenario: Ensure LANG is defined and contains UTF-8
81+
When container is started with args
82+
| arg | value |
83+
| command | bash -c "$JAVA_HOME/bin/java -XshowSettings:properties -version" |
84+
Then available container log should contain file.encoding = UTF-8
85+
86+
@ubi9
87+
Scenario: Ensure tar is installed (OPENJDK-1165)
88+
When container is started with args
89+
| arg | value |
90+
| command | tar |
91+
Then available container log should not contain command not found
92+
93+
@ubi9
94+
Scenario: Ensure tzdata RPM is properly installed (OPENJDK-2519)
95+
When container is started with args
96+
| arg | value |
97+
| command | rpm -V tzdata |
98+
Then available container log should not contain missing
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
#!/usr/bin/env bats
2+
source $BATS_TEST_DIRNAME/../../../../../../../test-common/cli_utils.sh
3+
# fake JBOSS_HOME
4+
export JBOSS_HOME=$BATS_TMPDIR/jboss_home
5+
rm -rf $JBOSS_HOME 2>/dev/null
6+
mkdir -p $JBOSS_HOME/bin/
7+
touch $JBOSS_HOME/bin/standalone.conf
8+
9+
export JBOSS_CONTAINER_UTIL_LOGGING_MODULE=$BATS_TMPDIR/logging
10+
mkdir -p "${JBOSS_CONTAINER_UTIL_LOGGING_MODULE}"
11+
cp $BATS_TEST_DIRNAME/../../../../../../../test-common/logging.sh "${JBOSS_CONTAINER_UTIL_LOGGING_MODULE}"
12+
source $BATS_TEST_DIRNAME/../artifacts/opt/jboss/container/wildfly/run/run-utils.sh
13+
14+
setup() {
15+
rm -f $JBOSS_HOME/bin/standalone.conf
16+
touch $JBOSS_HOME/bin/standalone.conf
17+
}
18+
19+
@test "Java 8" {
20+
JAVA_VERSION=1.8
21+
run run_add_jpms_options
22+
[ "${output}" = "" ]
23+
confFile=$(<"${JBOSS_HOME}/bin/standalone.conf")
24+
[ "${confFile}" = "" ]
25+
[ "$status" -eq 0 ]
26+
}
27+
28+
@test "Java 11" {
29+
JAVA_VERSION=11
30+
run run_add_jpms_options
31+
[ "${output}" = "" ]
32+
confFile=$(<"${JBOSS_HOME}/bin/standalone.conf")
33+
[ "${confFile}" = "" ]
34+
[ "$status" -eq 0 ]
35+
}
36+
37+
@test "JBoss Node name set to a value smaller than 23" {
38+
JBOSS_NODE_NAME=foo
39+
run_init_node_name
40+
[ "${JBOSS_NODE_NAME}" = "foo" ]
41+
[ "${JBOSS_TX_NODE_ID}" = "foo" ]
42+
}
43+
44+
@test "JBOSS_NODE_NAME set" {
45+
JBOSS_NODE_NAME=abcdefghijklmnopqrstuvwxyz123
46+
run_init_node_name
47+
echo $JBOSS_NODE_NAME
48+
49+
# Verify that jboss.node.name is untouched
50+
[ "${JBOSS_NODE_NAME}" = "abcdefghijklmnopqrstuvwxyz123" ]
51+
# Verify that jboss.tx.node.id is truncated to last 23 characters
52+
[ "${JBOSS_TX_NODE_ID}" = "ghijklmnopqrstuvwxyz123" ]
53+
}
54+
55+
@test "Node name set" {
56+
NODE_NAME=abcdefghijklmnopqrstuvwxyz
57+
run_init_node_name
58+
59+
# Verify that jboss.node.name is untouched
60+
[ "${JBOSS_NODE_NAME}" = "abcdefghijklmnopqrstuvwxyz" ]
61+
# Verify that jboss.tx.node.id is truncated to last 23 characters
62+
[ "${JBOSS_TX_NODE_ID}" = "defghijklmnopqrstuvwxyz" ]
63+
}
64+
65+
@test "Node name set to value smaller than 23" {
66+
NODE_NAME=abcdef
67+
run_init_node_name
68+
69+
# Verify that jboss.node.name is untouched
70+
[ "${JBOSS_NODE_NAME}" = "abcdef" ]
71+
# Verify that jboss.tx.node.id is untouched
72+
[ "${JBOSS_TX_NODE_ID}" = "abcdef" ]
73+
}
74+
75+
@test "Host name set" {
76+
HOSTNAME=abcdefghijklmnopqrstuvwxyz123
77+
run_init_node_name
78+
echo $JBOSS_NODE_NAME
79+
80+
# Verify that jboss.node.name is untouched
81+
[ "${JBOSS_NODE_NAME}" = "abcdefghijklmnopqrstuvwxyz123" ]
82+
# Verify that jboss.tx.node.id is truncated to last 23 characters
83+
[ "${JBOSS_TX_NODE_ID}" = "ghijklmnopqrstuvwxyz123" ]
84+
}

0 commit comments

Comments
 (0)