> On Oct. 6, 2017, 6:45 p.m., Sid Wagle wrote:
> > ambari-metrics/ambari-metrics-flume-sink/src/test/java/org/apache/hadoop/metrics2/sink/flume/FlumeTimelineMetricsSinkTest.java
> > Lines 84 (patched)
> > <https://reviews.apache.org/r/62805/diff/1/?file=1847470#file1847470line97>
> >
> >     Missing expectLastCall() ?

Calling a method on the mock sets up the expectation, so `expectLastCall()` is 
only needed if you want to tweak the expectation (eg. return value, call count, 
or exception thrown).

However, it turned out that `PowerMock.verifyAll()` did not verify expectations 
of `executor`, because it is not "maintained" by PowerMock.  This allowed the 
test to pass even with the `stop()` call removed.


- Attila


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/62805/#review187278
-----------------------------------------------------------


On Oct. 6, 2017, 10:39 p.m., Attila Doroszlai wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/62805/
> -----------------------------------------------------------
> 
> (Updated Oct. 6, 2017, 10:39 p.m.)
> 
> 
> Review request for Ambari, Aravindan Vijayan, Dmytro Sen, and Sid Wagle.
> 
> 
> Bugs: AMBARI-22155
>     https://issues.apache.org/jira/browse/AMBARI-22155
> 
> 
> Repository: ambari
> 
> 
> Description
> -------
> 
> Mock the executor to eliminate nondeterminism caused by threads.
> 
> 
> Diffs
> -----
> 
>   
> ambari-metrics/ambari-metrics-flume-sink/src/main/java/org/apache/hadoop/metrics2/sink/flume/FlumeTimelineMetricsSink.java
>  62779070419894064cb39ea5cc5da012572ff4cb 
>   
> ambari-metrics/ambari-metrics-flume-sink/src/test/java/org/apache/hadoop/metrics2/sink/flume/FlumeTimelineMetricsSinkTest.java
>  bd4ae6af88ee13f4ba6a3f14ac8c138b72d63c9d 
> 
> 
> Diff: https://reviews.apache.org/r/62805/diff/2/
> 
> 
> Testing
> -------
> 
> ```
> $ mvn -am -pl ambari-metrics/ambari-metrics-flume-sink clean test
> ...
> Tests run: 5, Failures: 0, Errors: 0, Skipped: 0
> ...
> [INFO] Reactor Summary:
> [INFO]
> [INFO] Ambari Main ........................................ SUCCESS [  6.159 
> s]
> [INFO] Apache Ambari Project POM .......................... SUCCESS [  0.036 
> s]
> [INFO] ambari-utility ..................................... SUCCESS [  3.880 
> s]
> [INFO] ambari-metrics ..................................... SUCCESS [  0.594 
> s]
> [INFO] Ambari Metrics Common .............................. SUCCESS [  4.240 
> s]
> [INFO] Ambari Metrics Flume Sink .......................... SUCCESS [  4.697 
> s]
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] BUILD SUCCESS
> ```
> 
> 
> Thanks,
> 
> Attila Doroszlai
> 
>

Reply via email to