Skip to content

Commit

Permalink
[OPENJDK-OPENJDK-2506] Clean up S2I tests
Browse files Browse the repository at this point in the history
Use binary-only builds where possible for speed; ensure descriptions are
succinct, correct and include JIRA issue where relevant; remove
unnecessary ENV var definitions; remove duplicate test.

https://issues.redhat.com/browse/OPENJDK-2506

Signed-off-by: Jonathan Dowland <[email protected]>
  • Loading branch information
jmtd committed Nov 30, 2023
1 parent 168022e commit b419efd
Showing 1 changed file with 40 additions and 70 deletions.
110 changes: 40 additions & 70 deletions tests/features/java/java_s2i.feature
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,25 @@
@ubi9/openjdk-17
@ubi9/openjdk-21
Feature: Openshift OpenJDK S2I tests
# NOTE: these tests should be usable with the other images once we have refactored the JDK scripts.
# These builds do not actually run maven. This is important, because the proxy
# options supplied do not specify a valid HTTP proxy.

# handles mirror/repository configuration; proxy configuration
Scenario: run the s2i and check the maven mirror and proxy have been initialised in the default settings.xml, uses http_proxy
Given s2i build https://github.com/jboss-container-images/openjdk-test-applications from spring-boot-sample-simple
| variable | value |
| MAVEN_ARGS | -v |
| MAVEN_MIRROR_URL | http://127.0.0.1:8080/repository/internal/ |
| http_proxy | 127.0.0.1:8080 |
And XML namespaces
| prefix | url |
| ns | http://maven.apache.org/SETTINGS/1.0.0 |
Then XML file /tmp/artifacts/configuration/settings.xml should have 1 elements on XPath //ns:proxy[ns:id='genproxy'][ns:active='true'][ns:protocol='http'][ns:host='127.0.0.1'][ns:port='8080']
Then XML file /tmp/artifacts/configuration/settings.xml should have 1 elements on XPath //ns:mirror[ns:id='mirror.default'][ns:url='http://127.0.0.1:8080/repository/internal/'][ns:mirrorOf='external:*']
# '/target' suffix triggers a binary-only build path. We use this a lot for unrelated
# tests here for speed. Most of these tests do not actually run Maven: this is important
# when the test specifies e.g. a dummy HTTP proxy value

Scenario: run s2i and check settings.xml is configured for maven mirror and http proxy
Given s2i build https://github.com/jboss-container-images/openjdk-test-applications from spring-boot-sample-simple/target
| variable | value |
| MAVEN_ARGS | -v |
| MAVEN_MIRROR_URL | http://127.0.0.1:8080/repository/internal/ |
| http_proxy | 127.0.0.1:8080 |
And XML namespaces
| prefix | url |
| ns | http://maven.apache.org/SETTINGS/1.0.0 |
Then XML file /tmp/artifacts/configuration/settings.xml should have 1 elements on XPath //ns:proxy[ns:id='genproxy'][ns:active='true'][ns:protocol='http'][ns:host='127.0.0.1'][ns:port='8080']
Then XML file /tmp/artifacts/configuration/settings.xml should have 1 elements on XPath //ns:mirror[ns:id='mirror.default'][ns:url='http://127.0.0.1:8080/repository/internal/'][ns:mirrorOf='external:*']

# proxy auth configuration (success case) + nonProxyHosts
Scenario: run the s2i and check the maven mirror, proxy (including username and password) and non proxy have been initialised in the default settings.xml, uses http_proxy
Given s2i build https://github.com/jboss-container-images/openjdk-test-applications from spring-boot-sample-simple
Scenario: run s2i and check settings.xml is configured for http proxy including user,pass and nonProxyHosts
Given s2i build https://github.com/jboss-container-images/openjdk-test-applications from spring-boot-sample-simple/target
| variable | value |
| MAVEN_ARGS | -v |
| http_proxy | myuser:mypass@127.0.0.1:8080 |
Expand All @@ -31,9 +30,8 @@ Feature: Openshift OpenJDK S2I tests
| ns | http://maven.apache.org/SETTINGS/1.0.0 |
Then XML file /tmp/artifacts/configuration/settings.xml should have 1 elements on XPath //ns:proxy[ns:id='genproxy'][ns:active='true'][ns:protocol='http'][ns:host='127.0.0.1'][ns:port='8080'][ns:username='myuser'][ns:password='mypass'][ns:nonProxyHosts='*.example.com']

# proxy auth configuration (fail case: no password supplied)
Scenario: run the s2i and check the maven mirror, proxy (including username) and non proxy have been initialised in the default settings.xml, uses http_proxy
Given s2i build https://github.com/jboss-container-images/openjdk-test-applications from spring-boot-sample-simple
Scenario: run s2i and check settings.xml is configured for http proxy including user (no password)
Given s2i build https://github.com/jboss-container-images/openjdk-test-applications from spring-boot-sample-simple/target
| variable | value |
| MAVEN_ARGS | -v |
| http_proxy | myuser@127.0.0.1:8080 |
Expand All @@ -42,22 +40,9 @@ Feature: Openshift OpenJDK S2I tests
| ns | http://maven.apache.org/SETTINGS/1.0.0 |
Then XML file /tmp/artifacts/configuration/settings.xml should have 1 elements on XPath //ns:proxy[ns:id='genproxy'][ns:active='true'][ns:protocol='http'][ns:host='127.0.0.1'][ns:port='8080']

# handles mirror/repository configuration; proxy configuration
Scenario: run the s2i and check the maven mirror and proxy have been initialised in the default settings.xml, uses http_proxy
Given s2i build https://github.com/jboss-container-images/openjdk-test-applications from spring-boot-sample-simple
| variable | value |
| MAVEN_ARGS | -v |
| MAVEN_MIRROR_URL | http://127.0.0.1:8080/repository/internal/ |
| http_proxy | 127.0.0.1:8080 |
And XML namespaces
| prefix | url |
| ns | http://maven.apache.org/SETTINGS/1.0.0 |
Then XML file /tmp/artifacts/configuration/settings.xml should have 1 elements on XPath //ns:proxy[ns:id='genproxy'][ns:active='true'][ns:protocol='http'][ns:host='127.0.0.1'][ns:port='8080']
Then XML file /tmp/artifacts/configuration/settings.xml should have 1 elements on XPath //ns:mirror[ns:id='mirror.default'][ns:url='http://127.0.0.1:8080/repository/internal/'][ns:mirrorOf='external:*']

# HTTP_PROXY (all caps) ignored
Scenario: run the s2i and check the maven mirror and proxy have been initialised in the default settings.xml, uses http_proxy and HTTP_PROXY
Given s2i build https://github.com/jboss-container-images/openjdk-test-applications from spring-boot-sample-simple
Scenario: run s2i, check http_proxy overrides HTTP_PROXY
Given s2i build https://github.com/jboss-container-images/openjdk-test-applications from spring-boot-sample-simple/target
| variable | value |
| MAVEN_ARGS | -v |
| http_proxy | 127.0.0.2:9090 |
Expand All @@ -68,22 +53,18 @@ Feature: Openshift OpenJDK S2I tests
Then XML file /tmp/artifacts/configuration/settings.xml should have 1 elements on XPath //ns:proxy[ns:id='genproxy'][ns:active='true'][ns:protocol='http'][ns:host='127.0.0.2'][ns:port='9090']
Then XML file /tmp/artifacts/configuration/settings.xml should have 0 elements on XPath //ns:proxy[ns:id='genproxy'][ns:active='true'][ns:protocol='http'][ns:host='127.0.0.1'][ns:port='8080']

# handles mirror/repository configuration; https proxy configuration
Scenario: run the s2i and check the maven mirror and proxy have been initialised in the default settings.xml, uses https_proxy
Given s2i build https://github.com/jboss-container-images/openjdk-test-applications from spring-boot-sample-simple
Scenario: run s2i and check settings.xml is configured for https proxy
Given s2i build https://github.com/jboss-container-images/openjdk-test-applications from spring-boot-sample-simple/target
| variable | value |
| MAVEN_ARGS | -v |
| MAVEN_MIRROR_URL | http://127.0.0.1:8080/repository/internal/ |
| https_proxy | 127.0.0.1:8080 |
And XML namespaces
| prefix | url |
| ns | http://maven.apache.org/SETTINGS/1.0.0 |
Then XML file /tmp/artifacts/configuration/settings.xml should have 1 elements on XPath //ns:proxy[ns:id='genproxy'][ns:active='true'][ns:protocol='https'][ns:host='127.0.0.1'][ns:port='8080']
Then XML file /tmp/artifacts/configuration/settings.xml should have 1 elements on XPath //ns:mirror[ns:id='mirror.default'][ns:url='http://127.0.0.1:8080/repository/internal/'][ns:mirrorOf='external:*']

# https proxy auth configuration (success case) + nonProxyHosts
Scenario: run the s2i and check the maven mirror, proxy (including username and password) and non proxy have been initialised in the default settings.xml, uses https_proxy
Given s2i build https://github.com/jboss-container-images/openjdk-test-applications from spring-boot-sample-simple
Scenario: run s2i and check settings.xml is configured for https proxy (including user and pass) and nonProxyHosts
Given s2i build https://github.com/jboss-container-images/openjdk-test-applications from spring-boot-sample-simple/target
| variable | value |
| MAVEN_ARGS | -v |
| https_proxy | myuser:mypass@127.0.0.1:8080 |
Expand All @@ -93,9 +74,8 @@ Feature: Openshift OpenJDK S2I tests
| ns | http://maven.apache.org/SETTINGS/1.0.0 |
Then XML file /tmp/artifacts/configuration/settings.xml should have 1 elements on XPath //ns:proxy[ns:id='genproxy'][ns:active='true'][ns:protocol='https'][ns:host='127.0.0.1'][ns:port='8080'][ns:username='myuser'][ns:password='mypass'][ns:nonProxyHosts='*.example.com']

# https proxy auth configuration (fail case: no password supplied)
Scenario: run the s2i and check the maven mirror, proxy (including username) and non proxy have been initialised in the default settings.xml, uses https_proxy
Given s2i build https://github.com/jboss-container-images/openjdk-test-applications from spring-boot-sample-simple
Scenario: run s2i and check settings.xml is configured for https proxy (without user and pass) when user only specified
Given s2i build https://github.com/jboss-container-images/openjdk-test-applications from spring-boot-sample-simple/target
| variable | value |
| MAVEN_ARGS | -v |
| https_proxy | myuser@127.0.0.1:8080 |
Expand All @@ -104,43 +84,28 @@ Feature: Openshift OpenJDK S2I tests
| ns | http://maven.apache.org/SETTINGS/1.0.0 |
Then XML file /tmp/artifacts/configuration/settings.xml should have 1 elements on XPath //ns:proxy[ns:id='genproxy'][ns:active='true'][ns:protocol='https'][ns:host='127.0.0.1'][ns:port='8080']

Scenario: run s2i assemble and check no_proxy is honoured with multiple entries
Given s2i build https://github.com/jboss-container-images/openjdk-test-applications from spring-boot-sample-simple
Scenario: run s2i and check no_proxy is honoured with multiple entries
Given s2i build https://github.com/jboss-container-images/openjdk-test-applications from spring-boot-sample-simple/target
| variable | value |
| MAVEN_ARGS | -v |
| MAVEN_MIRROR_URL | http://127.0.0.1:8080/repository/internal/ |
| http_proxy | http://127.0.0.1:8080 |
| no_proxy | foo.example.com,bar.example.com |
And XML namespaces
| prefix | url |
| ns | http://maven.apache.org/SETTINGS/1.0.0 |
Then XML file /tmp/artifacts/configuration/settings.xml should have 1 elements on XPath //ns:proxy[ns:id='genproxy'][ns:active='true'][ns:protocol='http'][ns:host='127.0.0.1'][ns:port='8080'][ns:nonProxyHosts='foo.example.com|bar.example.com']

# deprecated?
Scenario: run an S2I build that depends on com.redhat.xpaas.repo.redhatga being defined
Given s2i build https://github.com/jboss-container-images/openjdk-test-applications from spring-boot-sample-simple

# deprecated?
Scenario: run an S2I that should fail as MAVEN_ARGS does not define com.redhat.xpaas.repo.redhatga
Given failing s2i build https://github.com/jboss-container-images/openjdk-test-applications from spring-boot-sample-simple using openjdk-enforce-profile
| variable | value |
| MAVEN_ARGS | -e package |

# CLOUD-579
Scenario: Test that maven is executed in batch mode
Scenario: Test that maven is executed in batch mode (CLOUD-579)
Given s2i build https://github.com/jboss-container-images/openjdk-test-applications from spring-boot-sample-simple
Then s2i build log should contain --batch-mode
And s2i build log should not contain \r

# CLOUD-3095 - context dir should be recursively copied into the image
# "/target" suffix is important here; it triggers a different code-path (no source build)
Scenario: Ensure binary-only mode copies binaries into the target image
Scenario: Ensure binary-only mode recursively copies binaries into the target image (CLOUD-3095)
Given s2i build https://github.com/jboss-container-images/openjdk-test-applications from spring-boot-sample-simple/target
Then s2i build log should not contain skipping directory .
And run find /deployments in container and check its output for spring-boot-sample-simple-1.5.0.BUILD-SNAPSHOT.jar

# OPENJDK-1954 - MAVEN_REPOS
Scenario: run the s2i and check the maven mirror and proxy have been initialised in the default settings.xml, uses http_proxy
Scenario: run s2i and check multiple MAVEN_REPOS have been defined in settings.xml (OPENJDK-1954)
Given s2i build https://github.com/jboss-container-images/openjdk-test-applications from spring-boot-sample-simple/target
| variable | value |
| MAVEN_REPOS | TESTREPO,ANOTHER |
Expand All @@ -156,8 +121,7 @@ Feature: Openshift OpenJDK S2I tests
Then XML file /tmp/artifacts/configuration/settings.xml should have 1 elements on XPath //ns:server[ns:id='another']
Then XML file /tmp/artifacts/configuration/settings.xml should have 1 elements on XPath //ns:profile[ns:id='another-profile']/ns:repositories/ns:repository[ns:url='https://repo.example.org:8888/']

# OPENJDK-1961: MAVEN_REPO_URL and MAVEN_REPO_ID
Scenario: Check MAVEN_REPO_URL generates Maven settings and profile configuration
Scenario: Check MAVEN_REPO_URL and MAVEN_REPO_ID generate Maven server and profile configuration (OPENJDK-1961)
Given s2i build https://github.com/jboss-container-images/openjdk-test-applications from spring-boot-sample-simple/target
| variable | value |
| MAVEN_REPO_URL | http://repo.example.com:8080/maven2/ |
Expand All @@ -168,18 +132,24 @@ Feature: Openshift OpenJDK S2I tests
Then XML file /tmp/artifacts/configuration/settings.xml should have 1 elements on XPath //ns:server[ns:id='myrepo']
Then XML file /tmp/artifacts/configuration/settings.xml should have 1 elements on XPath //ns:profile[ns:id='myrepo-profile']/ns:repositories/ns:repository[ns:url='http://repo.example.com:8080/maven2/']

# This synthetic maven project has a lifecycle stage 'validate' configured to fail if MAVEN_ARGS is defined
# in the environment
Scenario: Ensure the environment is cleaned when executing mvn (OPENJDK-1549)
Given s2i build https://github.com/jboss-container-images/openjdk-test-applications from OPENJDK-1549 with env
| variable | value |
| MAVEN_ARGS | validate |

Scenario: Ensure that run-env.sh placed in the JAVA_APP_DIR is sourced in the run script before launching java
Scenario: Ensure that run-env.sh placed in the JAVA_APP_DIR is sourced in the run script before launching java (OPENJDK-2200)
Given s2i build https://github.com/jboss-container-images/openjdk-test-applications from quarkus-quickstarts/getting-started-3.0.1.Final-nos2i
| variable | value |
| S2I_SOURCE_DATA_DIR | ./ |
| S2I_TARGET_DATA_DIR | /deployments |
Then container log should contain INFO exec -a "someUniqueString" java

# This application source includes an override for s2i assemble which ensures there's
# a delay of 1 sec between invocation and delegating to the image's assemble. This is
# to catch the situation where the copy-artifacts stage of assemble does not preserve
# artifact timestamps.
Scenario: Ensure mtime is preserved for build artifacts (OPENJDK-2408)
Given s2i build https://github.com/jboss-container-images/openjdk-test-applications from OPENJDK-2408-bin-custom-s2i-assemble with env
| variable | value |
Expand Down

0 comments on commit b419efd

Please sign in to comment.