You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@slider.apache.org by st...@apache.org on 2015/11/20 22:07:51 UTC

[06/17] incubator-slider git commit: SLIDER-970: AASleepIT: initial AA test, hard coded to 1 node cluster

SLIDER-970: AASleepIT: initial AA test, hard coded to 1 node cluster


Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/a6eb923c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/a6eb923c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/a6eb923c

Branch: refs/heads/feature/SLIDER-82-pass-3.1
Commit: a6eb923cbdf4f1585f592c175c1f8778885a4373
Parents: 082eb0c
Author: Steve Loughran <st...@apache.org>
Authored: Wed Nov 18 22:02:00 2015 +0000
Committer: Steve Loughran <st...@apache.org>
Committed: Wed Nov 18 22:02:00 2015 +0000

----------------------------------------------------------------------
 .../test_min_pkg/sleep_cmd/resources.json       |   2 +-
 .../slider/funtest/lifecycle/AASleepIT.groovy   | 107 +++++++++++++++++++
 2 files changed, 108 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/a6eb923c/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 d2ab4f9..c5d7a2a 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
@@ -15,7 +15,7 @@
     },
     "SLEEP_LONG": {
       "yarn.role.priority": "1",
-      "yarn.component.instances": "1",
+      "yarn.component.instances": "0",
       "yarn.memory": "256",
       "yarn.placement.policy": "4"
     }

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/a6eb923c/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
new file mode 100644
index 0000000..e4a5d83
--- /dev/null
+++ b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AASleepIT.groovy
@@ -0,0 +1,107 @@
+/*
+ * 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.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
+import org.junit.After
+import org.junit.Before
+import org.junit.Test
+
+@CompileStatic
+@Slf4j
+public class AASleepIT extends AgentCommandTestBase
+    implements FuntestProperties, Arguments, SliderExitCodes, SliderActions {
+
+
+  static String CLUSTER = "test-aa-sleep"
+
+  static String TEST_RESOURCE = ResourcePaths.SLEEP_RESOURCES
+  static String TEST_METADATA = ResourcePaths.SLEEP_META
+  public static final String SLEEP_100 = "SLEEP_100"
+  public static final String SLEEP_LONG = "SLEEP_LONG"
+
+  @Before
+  public void prepareCluster() {
+    setupCluster(CLUSTER)
+  }
+
+  @After
+  public void destroyCluster() {
+    cleanup(CLUSTER)
+  }
+
+  @Test
+  public void testAASleepIt() throws Throwable {
+    describe("Test Anti-Affinity Placement")
+    def clusterpath = buildClusterPath(CLUSTER)
+    File launchReportFile = createTempJsonFile();
+
+    // TODO: Determine YARN cluster size via an API/CLI Call, maybe use labels too?
+    int yarnClusterSize = 1;
+    int desired = yarnClusterSize + 1
+    SliderShell shell = createSliderApplicationMinPkg(CLUSTER,
+        TEST_METADATA,
+        TEST_RESOURCE,
+        null,
+        [ARG_RES_COMP_OPT, SLEEP_LONG, "$desired"],
+        launchReportFile)
+
+    logShell(shell)
+
+    def appId = ensureYarnApplicationIsUp(launchReportFile)
+
+    //at this point the cluster should exist.
+    assertPathExists(
+        clusterFS,
+        "Cluster parent directory does not exist",
+        clusterpath.parent)
+
+    assertPathExists(clusterFS, "Cluster directory does not exist", clusterpath)
+
+    status(0, CLUSTER)
+    expectLiveContainerCountReached(CLUSTER, SLEEP_100, desired -1 ,
+        CONTAINER_LAUNCH_TIMEOUT)
+
+    // sleep for some manual test
+    describe("You may quickly perform manual tests against the application instance $CLUSTER")
+    sleep(1000 * 30)
+
+    //stop
+    freeze(0, CLUSTER,
+        [
+            ARG_WAIT, Integer.toString(FREEZE_WAIT_TIME),
+            ARG_MESSAGE, "final-shutdown"
+        ])
+
+    assertInYarnState(appId, YarnApplicationState.FINISHED)
+    destroy(0, CLUSTER)
+
+    //cluster now missing
+    exists(EXIT_UNKNOWN_INSTANCE, CLUSTER)
+  }
+}