SLIDER-570: AgentClusterLifecycleIT -> lookup/appId driven on thaw operations
Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/1f98074f Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/1f98074f Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/1f98074f Branch: refs/heads/develop Commit: 1f98074f16e7840d11727d9bcf1efb5a7858595e Parents: e1023ea Author: Steve Loughran <ste...@apache.org> Authored: Fri Oct 31 14:24:44 2014 +0000 Committer: Steve Loughran <ste...@apache.org> Committed: Fri Oct 31 14:24:44 2014 +0000 ---------------------------------------------------------------------- .../funtest/framework/CommandTestBase.groovy | 1 + .../lifecycle/AgentClusterLifecycleIT.groovy | 26 +++++++++++++++++--- 2 files changed, 23 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/1f98074f/slider-funtest/src/main/groovy/org/apache/slider/funtest/framework/CommandTestBase.groovy ---------------------------------------------------------------------- diff --git a/slider-funtest/src/main/groovy/org/apache/slider/funtest/framework/CommandTestBase.groovy b/slider-funtest/src/main/groovy/org/apache/slider/funtest/framework/CommandTestBase.groovy index 7ea84df..072b07e 100644 --- a/slider-funtest/src/main/groovy/org/apache/slider/funtest/framework/CommandTestBase.groovy +++ b/slider-funtest/src/main/groovy/org/apache/slider/funtest/framework/CommandTestBase.groovy @@ -692,6 +692,7 @@ abstract class CommandTestBase extends SliderTestUtils { "launch", ".json", new File("target")) + reportFile.delete() return reportFile } http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/1f98074f/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentClusterLifecycleIT.groovy ---------------------------------------------------------------------- diff --git a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentClusterLifecycleIT.groovy b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentClusterLifecycleIT.groovy index cb137ce..a0cb6ca 100644 --- a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentClusterLifecycleIT.groovy +++ b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentClusterLifecycleIT.groovy @@ -20,6 +20,7 @@ package org.apache.slider.funtest.lifecycle import groovy.transform.CompileStatic import groovy.util.logging.Slf4j +import org.apache.hadoop.yarn.api.records.YarnApplicationState import org.apache.slider.api.ClusterDescription import org.apache.slider.api.StatusKeys import org.apache.slider.client.SliderClient @@ -65,6 +66,7 @@ public class AgentClusterLifecycleIT extends AgentCommandTestBase def clusterpath = buildClusterPath(CLUSTER) assert !clusterFS.exists(clusterpath) + File launchReportFile = createAppReportFile(); SliderShell shell = createTemplatedSliderApplication(CLUSTER, APP_TEMPLATE, @@ -138,6 +140,9 @@ public class AgentClusterLifecycleIT extends AgentCommandTestBase ARG_MESSAGE, "freeze-in-test-cluster-lifecycle" ]) describe " >>> Cluster is now frozen." + + // should be in finished state, as this was a clean shutdown + assertInYarnState(appId, YarnApplicationState.FINISHED) //cluster exists if you don't want it to be live exists(0, CLUSTER, false) @@ -152,12 +157,19 @@ public class AgentClusterLifecycleIT extends AgentCommandTestBase list(-1, [ARG_LIVE]) list(-1, [ARG_STATE, "running"]) list( 0, [ARG_STATE, "FINISHED"]) - + + def thawReport = createAppReportFile() //start then stop the cluster thaw(CLUSTER, [ ARG_WAIT, Integer.toString(THAW_WAIT_TIME), + ARG_OUTPUT, thawReport.absolutePath, ]) + def thawedAppId = ensureYarnApplicationIsUp(thawReport) + + + assertAppRunning(thawedAppId) + exists(0, CLUSTER) describe " >>> Cluster is now thawed." list(0, [CLUSTER, ARG_LIVE]) @@ -175,6 +187,8 @@ public class AgentClusterLifecycleIT extends AgentCommandTestBase describe " >>> Cluster is now force frozen - 2nd time." + // new instance should be in killed state + assertInYarnState(thawedAppId, YarnApplicationState.KILLED) //cluster is no longer live exists(0, CLUSTER, false) @@ -183,19 +197,23 @@ public class AgentClusterLifecycleIT extends AgentCommandTestBase //start with a restart count set to enable restart describe "the kill/restart phase may fail if yarn.resourcemanager.am.max-attempts is too low" - + + def thawReport2 = createAppReportFile() + //start then stop the cluster thaw(CLUSTER, [ ARG_WAIT, Integer.toString(THAW_WAIT_TIME), - ARG_DEFINE, SliderXmlConfKeys.KEY_AM_RESTART_LIMIT + "=3" + ARG_DEFINE, SliderXmlConfKeys.KEY_AM_RESTART_LIMIT + "=3", + ARG_OUTPUT, thawReport2.absolutePath ]) - + def thawedAppId2 = ensureYarnApplicationIsUp(thawReport2) describe " >>> Cluster is now thawed - 2nd time." describe " >>> Kill AM and wait for restart." ClusterDescription status = killAmAndWaitForRestart(sliderClient, CLUSTER) + assertAppRunning(thawedAppId2) def restarted = status.getInfo( StatusKeys.INFO_CONTAINERS_AM_RESTART) assert restarted != null