OpenLiberty / sample-getting-started

Getting started sample
https://openliberty.io/start/
Other
13 stars 117 forks source link

Failed to run integration tests #50

Closed rbarrin2 closed 2 years ago

rbarrin2 commented 3 years ago

Running the downloded code get the following. Other than that the web page looks correct. [ERROR] it.io.openliberty.sample.health.HealthIT.testIfServicesAreDown() Time elapsed: 0.002 s <<< FAILURE! java.lang.NoClassDefFoundError: javax/ws/rs/client/ClientBuilder at it.io.openliberty.sample.health.HealthUtilIT.connectToHealthEnpoint(HealthUtilIT.java:46) at it.io.openliberty.sample.health.HealthIT.testIfServicesAreDown(HealthIT.java:42) Caused by: java.lang.ClassNotFoundException: javax.ws.rs.client.ClientBuilder at java.net.URLClassLoader.findClass(URLClassLoader.java:382) at java.lang.ClassLoader.loadClass(ClassLoader.java:418) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355) at java.lang.ClassLoader.loadClass(ClassLoader.java:351) ... 15 more

[ERROR] it.io.openliberty.sample.health.HealthIT.testIfServicesAreUp() Time elapsed: 0 s <<< FAILURE! java.lang.NoClassDefFoundError: javax/ws/rs/client/ClientBuilder at it.io.openliberty.sample.health.HealthUtilIT.connectToHealthEnpoint(HealthUtilIT.java:46) at it.io.openliberty.sample.health.HealthIT.testIfServicesAreUp(HealthIT.java:36)

[INFO] Running it.io.openliberty.sample.health.HealthUtilIT [INFO] [INFO] Results: [INFO] [ERROR] Failures: [ERROR] it.io.openliberty.sample.health.HealthIT#testIfServicesAreDown NoClassDefFoundError [ERROR] it.io.openliberty.sample.health.HealthIT#testIfServicesAreUp NoClassDefFoundError [INFO] [ERROR] Tests run: 2, Failures: 2, Errors: 0, Skipped: 0 [INFO] [ERROR] Failed to run integration tests [INFO] Press the Enter key to run tests on demand.

mbroz2 commented 3 years ago

I'm unable to reproduce this myself. When I run it, I get the expected result:

[INFO] -------------------------------------------------------
[INFO] Running it.io.openliberty.sample.health.HealthIT
[INFO] [WARNING ] CWMMH0052W: The class io.openliberty.microprofile.health30.impl.HealthCheck30ResponseImpl implementing HealthCheckResponse in the io.openliberty.sample.getting.started application in module io.openliberty.sample.getting.started.war, reported a DOWN status with data Optional[{services=not available}].
[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.097 s - in it.io.openliberty.sample.health.HealthIT
[INFO] 
[INFO] Results:
[INFO] 
[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0
[INFO] 
[INFO] Integration tests finished.
[INFO] Press the Enter key to run tests on demand.

Note that javax/ws/rs/client/ClientBuilder should be provided by the following test dependency defined in the pom.xml:

      <groupId>org.apache.cxf</groupId>
      <artifactId>cxf-rt-rs-extension-providers</artifactId>
      <version>3.4.3</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.glassfish</groupId>
      <artifactId>javax.json</artifactId>
      <version>1.1.4</version>
      <scope>test</scope>
    </dependency>

Can you try purging your maven cache and running mvn liberty:dev again?