SLIDER-970: preamble âreview and clean up existing functional tests, extracting resources to new file of constants, ResourcePaths.groovy
Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/ba33ecee Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/ba33ecee Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/ba33ecee Branch: refs/heads/feature/SLIDER-82-pass-3.1 Commit: ba33ecee613cead8ef53ed261c0f4d3ab1f83702 Parents: d4d343a Author: Steve Loughran <[email protected]> Authored: Wed Nov 18 15:55:41 2015 +0000 Committer: Steve Loughran <[email protected]> Committed: Wed Nov 18 16:01:41 2015 +0000 ---------------------------------------------------------------------- .../test_min_pkg/sleep_cmd/appConfig.json | 7 ++++ .../test_min_pkg/sleep_cmd/metainfo.json | 34 ++++++++++++-------- .../test_min_pkg/sleep_cmd/resources.json | 6 ++++ .../funtest/framework/CommandTestBase.groovy | 8 +---- .../apache/slider/funtest/ResourcePaths.groovy | 10 ++++-- .../funtest/lifecycle/AgentMinSleepIT.groovy | 14 ++++---- .../lifecycle/DemoAppsThroughAgent.groovy | 2 +- 7 files changed, 50 insertions(+), 31 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/ba33ecee/slider-core/src/test/app_packages/test_min_pkg/sleep_cmd/appConfig.json ---------------------------------------------------------------------- diff --git a/slider-core/src/test/app_packages/test_min_pkg/sleep_cmd/appConfig.json b/slider-core/src/test/app_packages/test_min_pkg/sleep_cmd/appConfig.json new file mode 100644 index 0000000..6e3ef14 --- /dev/null +++ b/slider-core/src/test/app_packages/test_min_pkg/sleep_cmd/appConfig.json @@ -0,0 +1,7 @@ +{ + "schema": "http://example.org/specification/v2.0.0", + "metadata": { + }, + "global": { + } +} http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/ba33ecee/slider-core/src/test/app_packages/test_min_pkg/sleep_cmd/metainfo.json ---------------------------------------------------------------------- diff --git a/slider-core/src/test/app_packages/test_min_pkg/sleep_cmd/metainfo.json b/slider-core/src/test/app_packages/test_min_pkg/sleep_cmd/metainfo.json index c8ada2c..073d1ff 100644 --- a/slider-core/src/test/app_packages/test_min_pkg/sleep_cmd/metainfo.json +++ b/slider-core/src/test/app_packages/test_min_pkg/sleep_cmd/metainfo.json @@ -1,16 +1,24 @@ { - "schemaVersion": "2.1", - "application": { - "name": "SLEEPER", - "components": [ - { - "name": "SLEEP_100", - "commands": [ - { - "exec": "sleep 180" - } - ] - } + "schemaVersion": "2.1", + "application": { + "name": "SLEEPER", + "components": [ + { + "name": "SLEEP_100", + "commands": [ + { + "exec": "sleep 180" + } ] - } + }, + { + "name": "SLEEP_LONG", + "commands": [ + { + "exec": "sleep 180000" + } + ] + } + ] + } } http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/ba33ecee/slider-core/src/test/app_packages/test_min_pkg/sleep_cmd/resources.json ---------------------------------------------------------------------- diff --git a/slider-core/src/test/app_packages/test_min_pkg/sleep_cmd/resources.json b/slider-core/src/test/app_packages/test_min_pkg/sleep_cmd/resources.json index be7b962..d2ab4f9 100644 --- a/slider-core/src/test/app_packages/test_min_pkg/sleep_cmd/resources.json +++ b/slider-core/src/test/app_packages/test_min_pkg/sleep_cmd/resources.json @@ -12,6 +12,12 @@ "yarn.role.priority": "1", "yarn.component.instances": "1", "yarn.memory": "256" + }, + "SLEEP_LONG": { + "yarn.role.priority": "1", + "yarn.component.instances": "1", + "yarn.memory": "256", + "yarn.placement.policy": "4" } } } http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/ba33ecee/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 d3a6680..218a081 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 @@ -88,7 +88,6 @@ abstract class CommandTestBase extends SliderTestUtils { * Keytab for secure cluster */ public static final String TEST_AM_KEYTAB - static File keytabFile /** * shell-escaped ~ symbol. On windows this does @@ -931,11 +930,7 @@ abstract class CommandTestBase extends SliderTestUtils { } // trigger a failure on registry lookup - SliderShell shell = registry(0, [ - ARG_NAME, - application, - ARG_LISTEXP - ]) + registry(0, [ARG_NAME, application, ARG_LISTEXP]) } } @@ -1206,7 +1201,6 @@ abstract class CommandTestBase extends SliderTestUtils { } public ClusterDescription execStatus(String application) { - ClusterDescription cd File statusFile = File.createTempFile("status", ".json") try { slider(EXIT_SUCCESS, http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/ba33ecee/slider-funtest/src/test/groovy/org/apache/slider/funtest/ResourcePaths.groovy ---------------------------------------------------------------------- diff --git a/slider-funtest/src/test/groovy/org/apache/slider/funtest/ResourcePaths.groovy b/slider-funtest/src/test/groovy/org/apache/slider/funtest/ResourcePaths.groovy index c93753d..5de2b8e 100644 --- a/slider-funtest/src/test/groovy/org/apache/slider/funtest/ResourcePaths.groovy +++ b/slider-funtest/src/test/groovy/org/apache/slider/funtest/ResourcePaths.groovy @@ -30,8 +30,12 @@ interface ResourcePaths { String COMMAND_LOG_APPCONFIG_NO_HB = "$SLIDER_CORE_APP_PACKAGES/test_command_log/appConfig_no_hb.json" String COMMAND_LOG_APPCONFIG_FAST_NO_REG = "$SLIDER_CORE_APP_PACKAGES/test_command_log/appConfig_fast_no_reg.json" - static String PING_RESOURCES = "$SLIDER_CORE_APP_PACKAGES/test_min_pkg/nc_ping_cmd/resources.json" - static String PING_META = "$SLIDER_CORE_APP_PACKAGES/test_min_pkg/nc_ping_cmd/metainfo.json" - static String PING_APPCONFIG = "$SLIDER_CORE_APP_PACKAGES/test_min_pkg/nc_ping_cmd/appConfig.json" + String PING_RESOURCES = "$SLIDER_CORE_APP_PACKAGES/test_min_pkg/nc_ping_cmd/resources.json" + String PING_META = "$SLIDER_CORE_APP_PACKAGES/test_min_pkg/nc_ping_cmd/metainfo.json" + String PING_APPCONFIG = "$SLIDER_CORE_APP_PACKAGES/test_min_pkg/nc_ping_cmd/appConfig.json" + + String SLEEP_RESOURCES = "$SLIDER_CORE_APP_PACKAGES/test_min_pkg/sleep_cmd/resources.json" + String SLEEP_META = "$SLIDER_CORE_APP_PACKAGES/test_min_pkg/sleep_cmd/metainfo.json" + String SLEEP_APPCONFIG = "$SLIDER_CORE_APP_PACKAGES/test_min_pkg/sleep_cmd/appConfig.json" } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/ba33ecee/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentMinSleepIT.groovy ---------------------------------------------------------------------- diff --git a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentMinSleepIT.groovy b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentMinSleepIT.groovy index b69effa..779316b 100644 --- a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentMinSleepIT.groovy +++ b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentMinSleepIT.groovy @@ -24,6 +24,7 @@ import org.apache.hadoop.yarn.api.records.YarnApplicationState import org.apache.slider.common.SliderExitCodes import org.apache.slider.common.params.Arguments import org.apache.slider.common.params.SliderActions +import org.apache.slider.funtest.ResourcePaths import org.apache.slider.funtest.framework.AgentCommandTestBase import org.apache.slider.funtest.framework.FuntestProperties import org.apache.slider.funtest.framework.SliderShell @@ -39,9 +40,8 @@ public class AgentMinSleepIT extends AgentCommandTestBase static String CLUSTER = "test-agent-sleep-100" - static String APP_RESOURCE11 = "../slider-core/src/test/app_packages/test_min_pkg/sleep_cmd/resources.json" - static String APP_META11 = "../slider-core/src/test/app_packages/test_min_pkg/sleep_cmd/metainfo.json" - + static String TEST_RESOURCE = ResourcePaths.SLEEP_RESOURCES + static String TEST_METADATA = ResourcePaths.SLEEP_META @Before public void prepareCluster() { @@ -54,14 +54,14 @@ public class AgentMinSleepIT extends AgentCommandTestBase } @Test - public void testAgentRegistry() throws Throwable { + public void testAgentMinSleepIt() throws Throwable { describe("Create a cluster using metainfo and resources only that executes sleep 100") def clusterpath = buildClusterPath(CLUSTER) File launchReportFile = createTempJsonFile(); SliderShell shell = createSliderApplicationMinPkg(CLUSTER, - APP_META11, - APP_RESOURCE11, + TEST_METADATA, + TEST_RESOURCE, null, [], launchReportFile) @@ -83,7 +83,7 @@ public class AgentMinSleepIT extends AgentCommandTestBase CONTAINER_LAUNCH_TIMEOUT) // sleep for some manual test - describe("You may quickly perform manual tests against the application instance " + CLUSTER) + describe("You may quickly perform manual tests against the application instance $CLUSTER") sleep(1000 * 30) //stop http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/ba33ecee/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/DemoAppsThroughAgent.groovy ---------------------------------------------------------------------- diff --git a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/DemoAppsThroughAgent.groovy b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/DemoAppsThroughAgent.groovy index 8ebb3d2..ea10390 100644 --- a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/DemoAppsThroughAgent.groovy +++ b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/DemoAppsThroughAgent.groovy @@ -39,7 +39,7 @@ public class DemoAppsThroughAgent extends AppsThroughAgentIT { @Override void destroyCluster() { -// super.destroyCluster() + } }
