Repository: tez Updated Branches: refs/heads/master 5e9e28f13 -> 6d3c02c91
TEZ-3589. add a unit test for amKeepAlive not being shutdown if an app takes a long time to launch. (sseth) Project: http://git-wip-us.apache.org/repos/asf/tez/repo Commit: http://git-wip-us.apache.org/repos/asf/tez/commit/6d3c02c9 Tree: http://git-wip-us.apache.org/repos/asf/tez/tree/6d3c02c9 Diff: http://git-wip-us.apache.org/repos/asf/tez/diff/6d3c02c9 Branch: refs/heads/master Commit: 6d3c02c914b9ba76a9de2ec5ab8fbfc9de8ad7af Parents: 5e9e28f Author: Siddharth Seth <[email protected]> Authored: Mon Jan 30 09:58:51 2017 -0800 Committer: Siddharth Seth <[email protected]> Committed: Mon Jan 30 09:58:51 2017 -0800 ---------------------------------------------------------------------- CHANGES.txt | 1 + .../org/apache/tez/client/TestTezClient.java | 21 +++++++++++++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tez/blob/6d3c02c9/CHANGES.txt ---------------------------------------------------------------------- diff --git a/CHANGES.txt b/CHANGES.txt index b16be7f..88398fe 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -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. http://git-wip-us.apache.org/repos/asf/tez/blob/6d3c02c9/tez-api/src/test/java/org/apache/tez/client/TestTezClient.java ---------------------------------------------------------------------- diff --git a/tez-api/src/test/java/org/apache/tez/client/TestTezClient.java b/tez-api/src/test/java/org/apache/tez/client/TestTezClient.java index c1f7fd1..c9415a4 100644 --- a/tez-api/src/test/java/org/apache/tez/client/TestTezClient.java +++ b/tez-api/src/test/java/org/apache/tez/client/TestTezClient.java @@ -829,9 +829,24 @@ public class TestTezClient { } + @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); @@ -846,7 +861,7 @@ public class TestTezClient { assertTrue(client.getAMKeepAliveService().isTerminated()); } - @Test(timeout = 12000) + @Test(timeout = 20000) public void testAMHeartbeatFailOnGetAMStatus() throws Exception { int amHeartBeatTimeoutSecs = 3; TezConfiguration conf = new TezConfiguration();
