You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@hive.apache.org by GitBox <gi...@apache.org> on 2022/07/21 22:24:15 UTC

[GitHub] [hive] jfsii commented on a diff in pull request #3458: HIVE-26411 Fix TestReplicationMetricCollector flakiness

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: gitbox-unsubscribe@hive.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org