jboss-container-images / openjdk

Source To Image (S2I) image for Red Hat OpenShift providing OpenJDK
Apache License 2.0
54 stars 58 forks source link

[OPENJDK-2722] Create dummy module to move jolokia.feature to module/jolokia #458

Closed jhuttana closed 6 months ago

jhuttana commented 6 months ago

Could you please review the changes?

jolokia.feature tests are failing even on the ubi8 branch. The trace I see on my branch is :

$ cekit --descriptor ubi8-openjdk-8.yaml test --image ubi8/openjdk-8 behave --name 'Check Environment variable is correct'
2024-03-13 17:07:28,966 tools.py:465        INFO  You are running on known platform: Fedora Linux 39 (Workstation Edition)
2024-03-13 17:07:28,966 tools.py:626        WARNING The certifi library (https://certifi.io/) was found, depending on the operating system configuration this may result in certificate validation issues. 
2024-03-13 17:07:28,966 tools.py:630        WARNING You can use REQUESTS_CA_BUNDLE environment variable to point to a different certificate bundle if using the certifi provided bundle doesn't work.
2024-03-13 17:07:28,966 tools.py:634        WARNING Certificate Authority (CA) bundle in use: '/etc/pki/tls/certs/ca-bundle.crt'
2024-03-13 17:07:28,966 base.py:108        INFO  Initializing image descriptor...
2024-03-13 17:07:28,973 resource.py:177        WARNING No value found for 'name' in '{"dest": "/tmp/artifacts/", "path": "modules"}' artifact; using auto-generated value of 'modules'
2024-03-13 17:07:28,976 resource.py:231        INFO  Copying resource 'modules'...
2024-03-13 17:07:29,218 base.py:376        INFO  Rendering Dockerfile...
2024-03-13 17:07:29,310 base.py:422        INFO  Rendering help.md page from template /usr/lib/python3.12/site-packages/cekit/generator/../templates/help.jinja
2024-03-13 17:07:29,323 collector.py:44         INFO  Fetching common steps from 'https://github.com/cekit/behave-test-steps.git', ref 'v1'.
Cloning into '/home/jhuttana/workarea/Containers/openjdk/target/test'...
remote: Enumerating objects: 18, done.
remote: Counting objects: 100% (18/18), done.
remote: Compressing objects: 100% (16/16), done.
remote: Total 18 (delta 1), reused 6 (delta 0), pack-reused 0
Receiving objects: 100% (18/18), 14.97 KiB | 104.00 KiB/s, done.
Resolving deltas: 100% (1/1), done.
2024-03-13 17:07:31,096 collector.py:77         INFO  Collecting finished!
USING RUNNER: behave.runner:Runner
Feature: Tests for all openshift images # features/image/openshift.feature:1

@ubi8/openjdk-8 @ubi8/openjdk-11 @ubi8/openjdk-17
Feature: Prometheus agent tests # features/image/prometheus.feature:4

@ubi8/openjdk-11 @ubi8/openjdk-17 @ubi8/openjdk-21
Feature: Openshift OpenJDK-only S2I tests # features/image/java/openjdk_s2i.feature:5

@ubi8/openjdk-8 @ubi8/openjdk-11 @ubi8/openjdk-17 @ubi8/openjdk-21
Feature: Openshift OpenJDK port tests # features/image/java/ports.feature:5

@ubi8/openjdk-8 @ubi8/openjdk-11 @ubi8/openjdk-17 @ubi8/openjdk-21
Feature: Openshift OpenJDK Runtime tests # features/image/java/runtime.feature:5

@ubi8
Feature: Openshift OpenJDK GC tests # features/jboss.container.java.jvm.api/gc.feature:2

Feature: OPENJDK-559 JVM Memory tests # features/jboss.container.java.jvm.api/memory.feature:1

@ubi8/openjdk-8 @ubi8/openjdk-11 @ubi8/openjdk-17 @ubi8/openjdk-21
Feature: Openshift S2I tests # features/jboss.container.java.run/java.security.feature:5

Feature: Openshift OpenJDK Jolokia tests # features/jboss.container.jolokiatest/jolokia.feature:2

  Scenario: Check Environment variable is correct                                                                                                                                                                    # features/jboss.container.jolokiatest/jolokia.feature:4
    Given s2i build https://github.com/jboss-container-images/openjdk-test-applications from undertow-servlet                                                                                                        # steps/s2i_steps.py:50
2024-03-13 17:07:31,238 s2i_steps.py:36         INFO  Executing new S2I build with the command [s2i build --loglevel=5 --pull-policy if-not-present  --context-dir=undertow-servlet -r=master  https://github.com/jboss-container-images/openjdk-test-applications ubi8/openjdk-8 integ-ubi8/openjdk-8  ]...

    Given s2i build https://github.com/jboss-container-images/openjdk-test-applications from undertow-servlet                                                                                                        # steps/s2i_steps.py:50 139.939s
    Then run sh -c 'unzip -q -p /usr/share/java/jolokia-jvm-agent/jolokia-jvm.jar META-INF/maven/org.jolokia/jolokia-jvm/pom.properties | grep -F ${JOLOKIA_VERSION}' in container and check its output for version= # steps/container_steps.py:305 80.285s
      Traceback (most recent call last):
        File "/home/jhuttana/.local/lib/python3.12/site-packages/behave/model.py", line 1812, in run
          match.run(runner.context)
        File "/home/jhuttana/.local/lib/python3.12/site-packages/behave/matchers.py", line 103, in run
          self.func(context, *args, **kwargs)
        File "steps/container_steps.py", line 337, in run_command_expect_message
          raise Exception("Phrase '%s' was not found in the output of running the '%s' command" % (output_phrase, cmd),
      Exception: ("Phrase 'version=' was not found in the output of running the 'sh -c 'unzip -q -p /usr/share/java/jolokia-jvm-agent/jolokia-jvm.jar META-INF/maven/org.jolokia/jolokia-jvm/pom.properties | grep -F ${JOLOKIA_VERSION}'' command", None, ExecException("container.execute: timeout reading from exec (command 'sh -c 'unzip -q -p /usr/share/java/jolokia-jvm-agent/jolokia-jvm.jar META-INF/maven/org.jolokia/jolokia-jvm/pom.properties | grep -F ${JOLOKIA_VERSION}'')"))

I am not sure what is wrong :)

jhuttana commented 6 months ago

I tried it on some old commit and there also it is failing

$ git branch -v
* (HEAD detached at 3620922) 3620922 [OPENJDK-2408] s2i: test mtimes preserved after artifact copy

$ cekit --descriptor ubi8-openjdk-8.yaml test --image ubi8/openjdk-8 behave --name 'Check Environment variable is correct'
2024-03-13 17:31:32,126 tools.py:465        INFO  You are running on known platform: Fedora Linux 39 (Workstation Edition)
2024-03-13 17:31:32,127 tools.py:626        WARNING The certifi library (https://certifi.io/) was found, depending on the operating system configuration this may result in certificate validation issues. 
2024-03-13 17:31:32,127 tools.py:630        WARNING You can use REQUESTS_CA_BUNDLE environment variable to point to a different certificate bundle if using the certifi provided bundle doesn't work.
2024-03-13 17:31:32,127 tools.py:634        WARNING Certificate Authority (CA) bundle in use: '/etc/pki/tls/certs/ca-bundle.crt'
2024-03-13 17:31:32,128 base.py:108        INFO  Initializing image descriptor...
2024-03-13 17:31:32,137 resource.py:177        WARNING No value found for 'name' in '{"dest": "/tmp/artifacts/", "path": "modules"}' artifact; using auto-generated value of 'modules'
2024-03-13 17:31:32,140 resource.py:231        INFO  Copying resource 'modules'...
2024-03-13 17:31:32,379 base.py:376        INFO  Rendering Dockerfile...
2024-03-13 17:31:32,465 base.py:422        INFO  Rendering help.md page from template /usr/lib/python3.12/site-packages/cekit/generator/../templates/help.jinja
2024-03-13 17:31:32,478 collector.py:44         INFO  Fetching common steps from 'https://github.com/cekit/behave-test-steps.git', ref 'v1'.
Cloning into '/home/jhuttana/workarea/Containers/openjdk/target/test'...
remote: Enumerating objects: 18, done.
remote: Counting objects: 100% (18/18), done.
remote: Compressing objects: 100% (16/16), done.
remote: Total 18 (delta 1), reused 6 (delta 0), pack-reused 0
Receiving objects: 100% (18/18), 14.97 KiB | 100.00 KiB/s, done.
Resolving deltas: 100% (1/1), done.
2024-03-13 17:31:34,161 collector.py:77         INFO  Collecting finished!
USING RUNNER: behave.runner:Runner
Feature: Miscellaneous general settings unit tests # features/image/general.feature:1

@ubi8/openjdk-8 @ubi8/openjdk-11 @ubi8/openjdk-17 @ubi8/openjdk-21
Feature: Openshift S2I tests # features/image/java.security.feature:5

Feature: Openshift OpenJDK Jolokia tests # features/image/jolokia.feature:2

  Scenario: Check Environment variable is correct                                                                                                                                                                    # features/image/jolokia.feature:4
    Given s2i build https://github.com/jboss-container-images/openjdk-test-applications from undertow-servlet                                                                                                        # steps/s2i_steps.py:50
2024-03-13 17:31:34,304 s2i_steps.py:36         INFO  Executing new S2I build with the command [s2i build --loglevel=5 --pull-policy if-not-present  --context-dir=undertow-servlet -r=master  https://github.com/jboss-container-images/openjdk-test-applications ubi8/openjdk-8 integ-ubi8/openjdk-8  ]...
Failing scenarios:
  features/image/jolokia.feature:4  Check Environment variable is correct

0 features passed, 1 failed, 14 skipped
0 scenarios passed, 1 failed, 91 skipped
1 step passed, 1 failed, 264 skipped, 0 undefined
Took 3m46.478s

Not sure how it will go here in GHA :)

jhuttana commented 6 months ago

Oh ! none of those tests failing here!

jmtd commented 6 months ago

Since there is only one jolokia module (modules/jolokia/8.2), the tests can just go there: we don't need a dummy module to share them between versions.

jhuttana commented 6 months ago

Since there is only one jolokia module (modules/jolokia/8.2), the tests can just go there: we don't need a dummy module to share them between versions.

Yes I will do that. While creating this patch I thought if in case we add another 8.x folder then it will be useful.