}
@Test
public void testRecoveredFromFailuresAfterRetries()
throws Exception {
FaultyThriftHiveMetastore metastore = new FaultyThriftHiveMetastore(
BackoffRetryTask.NUM_TRIES.getDefaultValue() - 1);
Configuration conf = new Configuration();
conf.setLong(BackoffRetryTask.INITIAL_RETRY_DELAY_MSEC.getKey(), 100);
HiveOutputDescription outputDesc = new HiveOutputDescription();
outputDesc.getTableDesc().setTableName("foo");
OutputConf outputConf = new OutputConf(conf, PROFILE_ID);
outputConf.writeOutputDescription(outputDesc);
HiveApiOutputFormat outputFormat = new HiveApiOutputFormat();
outputFormat.setMyProfileId(PROFILE_ID);
JobConf jobConf = new JobConf(conf);
TaskAttemptContext taskContext =
new HackTaskAttemptContext(jobConf, new TaskAttemptID());
JobContext jobContext = new HackJobContext(jobConf, taskContext.getJobID());
HiveMetastores.setTestClient(metastore);
outputFormat.checkOutputSpecs(jobContext);
assertEquals(
BackoffRetryTask.NUM_TRIES.getDefaultValue(),
metastore.getNumCalls());
}