Skip to content

Commit 135869f

Browse files
committed
Fix and enhance Behave GC tests
The Behave GC tests were broken by changes to (unrelated) JAVA_MAX_MEM_RATIO. The tests are too sensitive because they check the context around the arguments they are concerned about and are sensitive to ordering. Re-work the tests to only check for the parameter they are testing. Whilst we're at it, re-work them to not require S2I, either, and re-tag them to run on the runtime images too, now that they can. This should also reduce the time required to check them. Signed-off-by: Jonathan Dowland <[email protected]>
1 parent 6574add commit 135869f

File tree

1 file changed

+26
-33
lines changed

1 file changed

+26
-33
lines changed

tests/features/java/gc.feature

Lines changed: 26 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,64 @@
11
@openjdk
2-
@ubi8/openjdk-8
3-
@ubi8/openjdk-11
4-
@ubi8/openjdk-17
52
@redhat-openjdk-18
3+
@ubi8
64
Feature: Openshift OpenJDK GC tests
75

86
Scenario: Check default GC configuration
9-
Given s2i build https://github.com/jboss-openshift/openshift-quickstarts from undertow-servlet
10-
Then s2i build log should contain Using MAVEN_OPTS -XX:+UseParallelGC -XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=20 -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90
11-
And container log should contain -XX:+UseParallelGC -XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=20 -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90
7+
Given container is started as uid 1000
8+
Then container log should contain -XX:+UseParallelGC
9+
And container log should contain -XX:MinHeapFreeRatio=10
10+
And container log should contain -XX:MaxHeapFreeRatio=20
11+
And container log should contain -XX:GCTimeRatio=4
1212

1313
Scenario: Check GC_MIN_HEAP_FREE_RATIO GC configuration
14-
Given s2i build https://github.com/jboss-openshift/openshift-quickstarts from undertow-servlet
14+
Given container is started with env
1515
| variable | value |
1616
| GC_MIN_HEAP_FREE_RATIO | 5 |
17-
Then s2i build log should contain Using MAVEN_OPTS -XX:+UseParallelGC -XX:MinHeapFreeRatio=5 -XX:MaxHeapFreeRatio=20 -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90
18-
And container log should contain -XX:+UseParallelGC -XX:MinHeapFreeRatio=5 -XX:MaxHeapFreeRatio=20 -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90
17+
Then container log should contain -XX:MinHeapFreeRatio=5
1918

2019
Scenario: Check GC_MAX_HEAP_FREE_RATIO GC configuration
21-
Given s2i build https://github.com/jboss-openshift/openshift-quickstarts from undertow-servlet
20+
Given container is started with env
2221
| variable | value |
2322
| GC_MAX_HEAP_FREE_RATIO | 50 |
24-
Then s2i build log should contain Using MAVEN_OPTS -XX:+UseParallelGC -XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=50 -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90
25-
And container log should contain -XX:+UseParallelGC -XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=50 -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90
23+
Then container log should contain -XX:MaxHeapFreeRatio=50
2624

2725
Scenario: Check GC_TIME_RATIO GC configuration
28-
Given s2i build https://github.com/jboss-openshift/openshift-quickstarts from undertow-servlet
26+
Given container is started with env
2927
| variable | value |
3028
| GC_TIME_RATIO | 5 |
31-
Then s2i build log should contain Using MAVEN_OPTS -XX:+UseParallelGC -XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=20 -XX:GCTimeRatio=5 -XX:AdaptiveSizePolicyWeight=90
32-
And container log should contain -XX:+UseParallelGC -XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=20 -XX:GCTimeRatio=5 -XX:AdaptiveSizePolicyWeight=90
29+
Then container log should contain -XX:GCTimeRatio=5
3330

3431
Scenario: Check GC_ADAPTIVE_SIZE_POLICY_WEIGHT GC configuration
35-
Given s2i build https://github.com/jboss-openshift/openshift-quickstarts from undertow-servlet
32+
Given container is started with env
3633
| variable | value |
3734
| GC_ADAPTIVE_SIZE_POLICY_WEIGHT | 80 |
38-
Then s2i build log should contain Using MAVEN_OPTS -XX:+UseParallelGC -XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=20 -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=80
39-
And container log should contain -XX:+UseParallelGC -XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=20 -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=80
35+
Then container log should contain -XX:AdaptiveSizePolicyWeight=80
4036

4137
Scenario: Check GC_MAX_METASPACE_SIZE GC configuration
42-
Given s2i build https://github.com/jboss-openshift/openshift-quickstarts from undertow-servlet
38+
Given container is started with env
4339
| variable | value |
4440
| GC_MAX_METASPACE_SIZE | 120 |
45-
Then s2i build log should contain Using MAVEN_OPTS -XX:+UseParallelGC -XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=20 -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -XX:MaxMetaspaceSize=120m
46-
And container log should contain -XX:+UseParallelGC -XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=20 -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -XX:MaxMetaspaceSize=120m
41+
Then container log should contain -XX:MaxMetaspaceSize=120m
4742

4843
Scenario: Check GC_CONTAINER_OPTIONS configuration
49-
Given s2i build https://github.com/jboss-openshift/openshift-quickstarts from undertow-servlet
44+
Given container is started with env
5045
| variable | value |
5146
| GC_CONTAINER_OPTIONS | -XX:+UseG1GC |
52-
Then s2i build log should contain Using MAVEN_OPTS -XX:+UseG1GC
53-
And container log should contain -XX:+UseG1GC
47+
Then container log should contain -XX:+UseG1GC
5448
And container log should not contain -XX:+UseParallelGC
5549

5650
Scenario: Check GC_METASPACE_SIZE GC configuration
57-
Given s2i build https://github.com/jboss-openshift/openshift-quickstarts from undertow-servlet
58-
| variable | value |
51+
Given container is started with env
52+
| variable | value |
5953
| GC_METASPACE_SIZE | 120 |
60-
Then s2i build log should contain -XX:MetaspaceSize=120m
61-
And container log should contain -XX:MetaspaceSize=120m
54+
Then container log should contain -XX:MetaspaceSize=120m
6255
And container log should not contain integer expression expected
6356

6457
Scenario: Check GC_METASPACE_SIZE constrained by GC_MAX_METASPACE_SIZE GC configuration
65-
Given s2i build https://github.com/jboss-openshift/openshift-quickstarts from undertow-servlet
66-
| variable | value |
67-
| GC_METASPACE_SIZE | 120 |
58+
Given container is started with env
59+
| variable | value |
60+
| GC_METASPACE_SIZE | 120 |
6861
| GC_MAX_METASPACE_SIZE | 90 |
69-
Then s2i build log should contain -XX:MaxMetaspaceSize=90m -XX:MetaspaceSize=90m
70-
And container log should contain -XX:MaxMetaspaceSize=90m -XX:MetaspaceSize=90m
62+
Then container log should contain -XX:MaxMetaspaceSize=90m
63+
And container log should contain -XX:MetaspaceSize=90m
7164

0 commit comments

Comments
 (0)