use of org.apache.hadoop.hive.ql.parse.repl.dump.metric.IncrementalDumpMetricCollector in project hive by apache.
the class TestReplicationMetricUpdateOnFailure method testReplDumpNonRecoverableMissingStage.
@Test
public void testReplDumpNonRecoverableMissingStage() throws Exception {
String dumpDir = TEST_PATH + Path.SEPARATOR + testName.getMethodName();
MetricCollector.getInstance().deinit();
IncrementalDumpMetricCollector metricCollector = new IncrementalDumpMetricCollector(null, TEST_PATH, conf);
ReplDumpWork replDumpWork = Mockito.mock(ReplDumpWork.class);
Mockito.when(replDumpWork.getCurrentDumpPath()).thenReturn(new Path(dumpDir));
Mockito.when(replDumpWork.getMetricCollector()).thenReturn(metricCollector);
Mockito.when(replDumpWork.dataCopyIteratorsInitialized()).thenThrow(nonRecoverableException);
Task replDumpTask = TaskFactory.get(replDumpWork, conf);
// ensure stages are missing initially and execute without reporting start metrics
Assert.assertEquals(0, MetricCollector.getInstance().getMetrics().size());
Assert.assertThrows(RuntimeException.class, () -> replDumpTask.execute());
performNonRecoverableChecks(dumpDir, "REPL_DUMP");
}
Aggregations