SLIDER-970: AASleepIT, test completes, added a demo subclass
Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/3418d72e Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/3418d72e Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/3418d72e Branch: refs/heads/develop Commit: 3418d72e58b842890231452aa5d02610e722d4f8 Parents: ee6e5f6 Author: Steve Loughran <[email protected]> Authored: Thu Nov 19 18:46:32 2015 +0000 Committer: Steve Loughran <[email protected]> Committed: Thu Nov 19 18:50:16 2015 +0000 ---------------------------------------------------------------------- .../test_min_pkg/sleep_cmd/resources.json | 6 +-- .../funtest/framework/CommandTestBase.groovy | 10 ++--- .../slider/funtest/lifecycle/AASleepIT.groovy | 31 +++++++++++++-- .../slider/funtest/lifecycle/DemoAASleep.groovy | 41 ++++++++++++++++++++ 4 files changed, 76 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/3418d72e/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 c5d7a2a..1268996 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 @@ -11,12 +11,12 @@ "SLEEP_100": { "yarn.role.priority": "1", "yarn.component.instances": "1", - "yarn.memory": "256" + "yarn.memory": "128" }, "SLEEP_LONG": { - "yarn.role.priority": "1", + "yarn.role.priority": "2", "yarn.component.instances": "0", - "yarn.memory": "256", + "yarn.memory": "128", "yarn.placement.policy": "4" } } http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/3418d72e/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 218a081..654ccb3 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 @@ -29,14 +29,14 @@ import org.apache.hadoop.util.Shell import org.apache.hadoop.yarn.api.records.YarnApplicationState import org.apache.hadoop.yarn.conf.YarnConfiguration import org.apache.slider.api.StatusKeys -import org.apache.slider.common.tools.ConfigHelper -import org.apache.slider.core.launch.SerializedApplicationReport -import org.apache.slider.core.main.ServiceLauncher +import org.apache.slider.client.SliderClient import org.apache.slider.common.SliderKeys import org.apache.slider.common.SliderXmlConfKeys import org.apache.slider.api.ClusterDescription +import org.apache.slider.common.tools.ConfigHelper import org.apache.slider.common.tools.SliderUtils -import org.apache.slider.client.SliderClient +import org.apache.slider.core.launch.SerializedApplicationReport +import org.apache.slider.core.main.ServiceLauncher import org.apache.slider.core.persist.ApplicationReportSerDeser import org.apache.slider.test.SliderTestUtils import org.apache.slider.test.Outcome; @@ -817,7 +817,7 @@ abstract class CommandTestBase extends SliderTestUtils { } public static SerializedApplicationReport loadAppReport(File reportFile) { - if (reportFile.exists() && reportFile.length()> 0) { + if (reportFile.exists() && reportFile.length() > 0) { ApplicationReportSerDeser serDeser = new ApplicationReportSerDeser() def report = serDeser.fromFile(reportFile) return report http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/3418d72e/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AASleepIT.groovy ---------------------------------------------------------------------- diff --git a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AASleepIT.groovy b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AASleepIT.groovy index e549b70..464b329 100644 --- a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AASleepIT.groovy +++ b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AASleepIT.groovy @@ -21,9 +21,11 @@ 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.ResourceKeys import org.apache.slider.common.SliderExitCodes import org.apache.slider.common.params.Arguments import org.apache.slider.common.params.SliderActions +import org.apache.slider.core.launch.SerializedApplicationReport import org.apache.slider.funtest.ResourcePaths import org.apache.slider.funtest.framework.AgentCommandTestBase import org.apache.slider.funtest.framework.FuntestProperties @@ -62,13 +64,12 @@ public class AASleepIT extends AgentCommandTestBase File launchReportFile = createTempJsonFile(); // TODO: Determine YARN cluster size via an API/CLI Call, maybe use labels too? - int yarnClusterSize = 1; - int desired = yarnClusterSize + 1 + int desired = buildDesiredCount(1) SliderShell shell = createSliderApplicationMinPkg(CLUSTER, TEST_METADATA, TEST_RESOURCE, ResourcePaths.SLEEP_APPCONFIG, - [ARG_RES_COMP_OPT, SLEEP_LONG, Integer.toString(desired)], + [ARG_RES_COMP_OPT, SLEEP_LONG, ResourceKeys.COMPONENT_INSTANCES, Integer.toString(desired)], launchReportFile) logShell(shell) @@ -84,9 +85,13 @@ public class AASleepIT extends AgentCommandTestBase assertPathExists(clusterFS, "Cluster directory does not exist", clusterpath) status(0, CLUSTER) - expectLiveContainerCountReached(CLUSTER, SLEEP_100, desired -1 , + + def expected = buildExpectedCount(desired) + expectLiveContainerCountReached(CLUSTER, SLEEP_100, expected, CONTAINER_LAUNCH_TIMEOUT) + operations(CLUSTER, loadAppReport(launchReportFile), desired, expected) + // sleep for some manual test describe("You may quickly perform manual tests against the application instance $CLUSTER") sleep(1000 * 30) @@ -104,4 +109,22 @@ public class AASleepIT extends AgentCommandTestBase //cluster now missing exists(EXIT_UNKNOWN_INSTANCE, CLUSTER) } + + protected int buildExpectedCount(int desired) { + desired - 1 + } + + protected int buildDesiredCount(int clustersize) { + clustersize + 1 + } + + protected void operations(String name, + SerializedApplicationReport appReport, + int desired, + int expected ) { + // sleep for some manual test + describe("You may quickly perform manual tests against the application instance $CLUSTER") + sleep(1000 * 30) + + } } http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/3418d72e/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/DemoAASleep.groovy ---------------------------------------------------------------------- diff --git a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/DemoAASleep.groovy b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/DemoAASleep.groovy new file mode 100644 index 0000000..7d0ee46 --- /dev/null +++ b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/DemoAASleep.groovy @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.slider.funtest.lifecycle + +import groovy.transform.CompileStatic +import groovy.util.logging.Slf4j +import org.apache.slider.core.launch.SerializedApplicationReport + +@CompileStatic +@Slf4j +class DemoAASleep extends AASleepIT { + + @Override + protected void operations( + String name, + SerializedApplicationReport appReport, + int desired, + int expected) { + super.operations(name, appReport, desired, expected) + + describe("cluster is live at ${appReport.url}") + + sleep(10 * 60 * 1000) + } +}
