Skip to content

Commit f9de718

Browse files
committed
Added negative UT
1 parent 70a8880 commit f9de718

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

tez-dag/src/test/java/org/apache/tez/dag/app/TestDAGAppMaster.java

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ public void testBadProgress() throws Exception {
475475
}
476476

477477
@Test
478-
public void testShutdownTezAMWithNoCurrentRunningDAG() throws Exception {
478+
public void testShutdownTezAMWithNoCurrentRunningDAGAndConfigSet() throws Exception {
479479

480480
ApplicationId appId = ApplicationId.newInstance(1, 1);
481481
ApplicationAttemptId attemptId = ApplicationAttemptId.newInstance(appId, 2);
@@ -491,6 +491,23 @@ public void testShutdownTezAMWithNoCurrentRunningDAG() throws Exception {
491491
Assert.assertEquals(dam.getState(), DAGAppMasterState.FAILED);
492492
}
493493

494+
@Test
495+
public void testShutdownTezAMWithNoCurrentRunningDAGAndConfigUnset() throws Exception {
496+
497+
ApplicationId appId = ApplicationId.newInstance(1, 1);
498+
ApplicationAttemptId attemptId = ApplicationAttemptId.newInstance(appId, 2);
499+
DAGAppMasterForTest dam = new DAGAppMasterForTest(attemptId, true);
500+
TezConfiguration conf = new TezConfiguration(false);
501+
conf.setBoolean(TezConfiguration.DAG_RECOVERY_ENABLED, false);
502+
conf.setBoolean(TezConfiguration.TEZ_AM_FAIL_ON_SHUTDOWN_AND_NO_RUNNING_DAGS, false);
503+
dam.init(conf);
504+
dam.start();
505+
verify(dam.mockScheduler).setShouldUnregisterFlag();
506+
verify(dam.mockShutdown).shutdown();
507+
508+
Assert.assertEquals(dam.getState(), DAGAppMasterState.SUCCEEDED);
509+
}
510+
494511
@SuppressWarnings("deprecation")
495512
private void testDagCredentials(boolean doMerge) throws IOException {
496513
TezConfiguration conf = new TezConfiguration();

0 commit comments

Comments
 (0)