jfsii commented on code in PR #3458:
URL: https://github.com/apache/hive/pull/3458#discussion_r927147243


##########
ql/src/test/org/apache/hadoop/hive/ql/parse/repl/metric/TestReplicationMetricCollector.java:
##########
@@ -75,6 +84,12 @@ public void setup() throws Exception {
     MetricCollector.getInstance().init(conf);
     Mockito.when(fmd.getFailoverEventId()).thenReturn(10L);
     Mockito.when(fmd.getFilePath()).thenReturn("dummyDir");
+    disableBackgroundThreads();
+  }
+
+  private void disableBackgroundThreads() {
+    PowerMockito.mockStatic(MetricSink.class);
+    Mockito.when(MetricSink.getInstance()).thenReturn(metricSinkInstance);

Review Comment:
   I'm new to the this testing framework - but I assume my understanding is 
correct:
   This works because metricSinkInstance gets its MetricSink() constructor 
called because it is annotated with Mock and since the metricSinkInstance never 
gets init called on it, it never starts the executorService, correct?



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to