You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/03/07 13:44:11 UTC

[GitHub] [pulsar] lhotari commented on issue #13620: Flaky-test: Spy creation sporadically fails in some tests and causes Mockito misuse warning

lhotari commented on issue #13620:
URL: https://github.com/apache/pulsar/issues/13620#issuecomment-1060702619


   [recent failure](https://github.com/apache/pulsar/runs/5445398064?check_suite_focus=true#step:9:469)
   ```
   Error:  Tests run: 91, Failures: 26, Errors: 0, Skipped: 49, Time elapsed: 21.236 s <<< FAILURE! - in org.apache.pulsar.broker.service.persistent.PersistentTopicStreamingDispatcherTest
   Error:  setup(org.apache.pulsar.broker.service.persistent.PersistentTopicStreamingDispatcherTest)  Time elapsed: 0.129 s  <<< FAILURE!
   org.mockito.exceptions.misusing.WrongTypeOfReturnValue: 
   
   BrokerService cannot be returned by getPulsarResources()
   getPulsarResources() should return PulsarResources
   ***
   If you're unsure why you're getting above error read on.
   Due to the nature of the syntax above problem might occur because:
   1. This exception *might* occur in wrongly written multi-threaded tests.
      Please refer to Mockito FAQ on limitations of concurrency testing.
   2. A spy is stubbed using when(spy.foo()).then() syntax. It is safer to stub spies - 
      - with doReturn|Throw() family of methods. More in javadocs for Mockito.spy() method.
   
   	at org.apache.pulsar.broker.PulsarService.getBrokerService(PulsarService.java:1189)
   	at org.apache.pulsar.broker.service.PersistentTopicTest.setup(PersistentTopicTest.java:212)
   	at org.apache.pulsar.broker.service.persistent.PersistentTopicStreamingDispatcherTest.setup(PersistentTopicStreamingDispatcherTest.java:34)
   	at jdk.internal.reflect.GeneratedMethodAccessor211.invoke(Unknown Source)
   	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
   	at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:132)
   	at org.testng.internal.MethodInvocationHelper.invokeMethodConsideringTimeout(MethodInvocationHelper.java:61)
   ```


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org