[ 
https://issues.apache.org/jira/browse/HADOOP-9057?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13507645#comment-13507645
 ] 

Xuan Gong commented on HADOOP-9057:
-----------------------------------

The timeout in mockito verify is a great idea. It actually verify the callback 
before we call the stop function. 

But I think that we may need add another test case to verify the stop(). I 
think that the purpose of this stop()  is when I call this function, all the 
sink threads should stop no matter they are idle or they are doing something. 

And actually the test is fail, on the other side, it proved that our stop 
function is actually worked correctly. When we call the stop, everything is 
stopped no matter what they are doing right now. Based on that, I runned this 
test several times, I found that sometimes it will be successful, sometimes 
half rigth half wrong, sometimes all fails.
That is why orignally we try to add Thread.sleep() and try to buy some times 
for the sink threads to consume all the items in queue.

Maybe you can take a look at the HADOOP-8981, this is the duplication issue. I 
uploaded patches verion 3, including the test case that using the mockito 
timeout and another test case to verify stop function. 
                
> TestMetricsSystemImpl.testInitFirst fails intermittently
> --------------------------------------------------------
>
>                 Key: HADOOP-9057
>                 URL: https://issues.apache.org/jira/browse/HADOOP-9057
>             Project: Hadoop Common
>          Issue Type: Bug
>    Affects Versions: 1-win
>            Reporter: Ivan Mitic
>            Assignee: Ivan Mitic
>         Attachments: HADOOP-9057.branch-1-win.metricsrace.patch
>
>
> Error Message
>  Wanted but not invoked: metricsSink.putMetrics(<Capturing argument>); -> at 
> org.apache.hadoop.metrics2.impl.TestMetricsSystemImpl.testInitFirst(TestMetricsSystemImpl.java:80)
>  Actually, there were zero interactions with this mock. 
> Stacktrace
> Wanted but not invoked:
> metricsSink.putMetrics(<Capturing argument>);
> -> at 
> org.apache.hadoop.metrics2.impl.TestMetricsSystemImpl.testInitFirst(TestMetricsSystemImpl.java:80)
> Actually, there were zero interactions with this mock.
>       at 
> org.apache.hadoop.metrics2.impl.TestMetricsSystemImpl.testInitFirst(TestMetricsSystemImpl.java:80)
>       at 
> org.mockito.internal.runners.JUnit45AndHigherRunnerImpl.run(JUnit45AndHigherRunnerImpl.java:37)
>       at 
> org.mockito.runners.MockitoJUnitRunner.run(MockitoJUnitRunner.java:62)
> Standard Output
> 2012-10-04 11:43:55,641 INFO  impl.MetricsConfig 
> (MetricsConfig.java:loadFirst(99)) - loaded properties from 
> hadoop-metrics2-test.properties

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to