BewareMyPower commented on PR #25100:
URL: https://github.com/apache/pulsar/pull/25100#issuecomment-3754347751

   Summary of the Fix
   The error "Cannot instrument class 
org.apache.pulsar.broker.testcontext.StartableTestPulsarService" was caused by 
missing Jetty WebSocket dependencies in the pulsar-broker module, not just a 
visibility issue with the test classes.
   Root Cause
   When Mockito tried to create a spy of StartableTestPulsarService (which 
extends PulsarService), it needed to load all classes referenced in 
PulsarService, including JettyWebSocketServlet from 
org.eclipse.jetty.ee8.websocket.server. This class was not available in the 
broker's compile classpath, causing a ClassNotFoundException during Mockito's 
class initialization phase.
   Changes Made
   1. Made test classes public (initial attempt):
      - AbstractTestPulsarService at 
/Users/xuyunze/github.com/bewaremypower/pulsar/pulsar-broker/src/test/java/org/apache/pulsar/broker/testcontext/AbstractTestPulsarService.java:47
      - StartableTestPulsarService at 
/Users/xuyunze/github.com/bewaremypower/pulsar/pulsar-broker/src/test/java/org/apache/pulsar/broker/testcontext/StartableTestPulsarService.java:42
      - NonStartableTestPulsarService at 
/Users/xuyunze/github.com/bewaremypower/pulsar/pulsar-broker/src/test/java/org/apache/pulsar/broker/testcontext/NonStartableTestPulsarService.java:59
   2. Added missing Jetty WebSocket dependency (the actual fix):
      - Added jetty-ee8-websocket-jetty-server dependency to 
pulsar-broker/pom.xml at line 85-88
   
   I'm wondering why CI passed.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to