Skip to content

Commit

Permalink
TEZ-3589. add a unit test for amKeepAlive not being shutdown if an app
Browse files Browse the repository at this point in the history
takes a long time to launch. (sseth)
  • Loading branch information
sidseth committed Jan 30, 2017
1 parent 5e9e28f commit 6d3c02c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ INCOMPATIBLE CHANGES

ALL CHANGES:

TEZ-3589. add a unit test for amKeepAlive not being shutdown if an app takes a long time to launch.
TEZ-3417. Reduce sleep time on AM shutdown to reduce test runtimes
TEZ-3582. Exception swallowed in PipelinedSorter causing incorrect results.
TEZ-3584. amKeepAliveService in TezClient should shutdown in case of AM failure.
Expand Down
21 changes: 18 additions & 3 deletions tez-api/src/test/java/org/apache/tez/client/TestTezClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -829,9 +829,24 @@ public void testAMClientHeartbeat() throws Exception {

}

@Test(timeout = 20000)
public void testAMHeartbeatFailOnGetAMProxy_AppNotStarted() throws Exception {
int amHeartBeatTimeoutSecs = 3;
TezConfiguration conf = new TezConfiguration();
conf.setInt(TezConfiguration.TEZ_AM_CLIENT_HEARTBEAT_TIMEOUT_SECS, amHeartBeatTimeoutSecs);

@Test(timeout = 10000)
public void testAMHeartbeatFailOnGetAMProxy() throws Exception {
final TezClientForTest client = configureAndCreateTezClient(conf);
client.callRealGetSessionAMProxy = true;
client.start();

when(client.mockYarnClient.getApplicationReport(client.mockAppId).getYarnApplicationState())
.thenReturn(YarnApplicationState.ACCEPTED);
Thread.sleep(2 * amHeartBeatTimeoutSecs * 1000);
assertFalse(client.getAMKeepAliveService().isTerminated());
}

@Test(timeout = 20000)
public void testAMHeartbeatFailOnGetAMProxy_AppFailed() throws Exception {
int amHeartBeatTimeoutSecs = 3;
TezConfiguration conf = new TezConfiguration();
conf.setInt(TezConfiguration.TEZ_AM_CLIENT_HEARTBEAT_TIMEOUT_SECS, amHeartBeatTimeoutSecs);
Expand All @@ -846,7 +861,7 @@ public void testAMHeartbeatFailOnGetAMProxy() throws Exception {
assertTrue(client.getAMKeepAliveService().isTerminated());
}

@Test(timeout = 12000)
@Test(timeout = 20000)
public void testAMHeartbeatFailOnGetAMStatus() throws Exception {
int amHeartBeatTimeoutSecs = 3;
TezConfiguration conf = new TezConfiguration();
Expand Down

0 comments on commit 6d3c02c

Please sign in to comment.