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


##########
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:
   Yes, this is the main idea and I verified locally with the debugger that the 
background threads are not started. Precisely what happens is that whenever 
MetricSink.getInstance() is called, it returns the mock metricSinkInstance and 
even if its init() is called, it does nothing because it's an empty method 
provided by the mock framework.



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