Steve Vaughan created HDFS-16932: ------------------------------------ Summary: Mockito causing ClassCastException Key: HDFS-16932 URL: https://issues.apache.org/jira/browse/HDFS-16932 Project: Hadoop HDFS Issue Type: Bug Components: hdfs Affects Versions: 3.4.0 Environment: Running in the Hadoop development environment in docker, running mvn. Reporter: Steve Vaughan
Running tests in TestBalancerRPCDelay fails because of ClassCastExceptions introduced by Mockito. As an example, in this stack trace note that the RedundancyMonitor is calling "isRunning" but incorrectly ends up being routed to getBlocks (which returns BlocksWithLocations) via TestBalancer and a Mockito Spy. This ultimately is reported as a failure during the shutdown process. {{Exception in thread "RedundancyMonitor" java.lang.ClassCastException: java.lang.Boolean cannot be cast to org.apache.hadoop.hdfs.server.protocol.BlocksWithLocations}}{{ at org.apache.hadoop.hdfs.server.balancer.TestBalancer$2.answer(TestBalancer.java:1865)}}{{ at org.apache.hadoop.hdfs.server.balancer.TestBalancer$2.answer(TestBalancer.java:1858)}}{{ at org.mockito.internal.stubbing.StubbedInvocationMatcher.answer(StubbedInvocationMatcher.java:39)}}{{ at org.mockito.internal.handler.MockHandlerImpl.handle(MockHandlerImpl.java:96)}}{{ at org.mockito.internal.handler.NullResultGuardian.handle(NullResultGuardian.java:29)}}{{ at org.mockito.internal.handler.InvocationNotifierHandler.handle(InvocationNotifierHandler.java:35)}}{{ at org.mockito.internal.creation.bytebuddy.MockMethodInterceptor.doIntercept(MockMethodInterceptor.java:61)}}{{ at org.mockito.internal.creation.bytebuddy.MockMethodInterceptor.doIntercept(MockMethodInterceptor.java:49)}}{{ at org.mockito.internal.creation.bytebuddy.MockMethodInterceptor$DispatcherDefaultingToRealMethod.interceptSuperCallable(MockMethodInterceptor.java:108)}}{{ at org.apache.hadoop.hdfs.server.namenode.FSNamesystem$MockitoMock$1070381809.isRunning(Unknown Source)}}{{ at org.apache.hadoop.hdfs.server.blockmanagement.BlockManager$RedundancyMonitor.run(BlockManager.java:5155)}}{{ at java.lang.Thread.run(Thread.java:750)}} -- This message was sent by Atlassian Jira (v8.20.10#820010) --------------------------------------------------------------------- To unsubscribe, e-mail: hdfs-dev-unsubscr...@hadoop.apache.org For additional commands, e-mail: hdfs-dev-h...@hadoop.apache.org