Repository: incubator-slider
Updated Branches:
  refs/heads/develop 6b011d925 -> 2051dd641


SLIDER-470 slider appears to support negative component counts


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

Branch: refs/heads/develop
Commit: ca8888992abfcd1ffff7f9e0fc4f0c677fdbdb0c
Parents: 6b011d9
Author: Steve Loughran <[email protected]>
Authored: Thu Oct 2 09:32:52 2014 -0700
Committer: Steve Loughran <[email protected]>
Committed: Thu Oct 2 09:32:52 2014 -0700

----------------------------------------------------------------------
 ...ndaloneClusterNegativeComponentCounts.groovy | 79 ++++++++++++++++++++
 1 file changed, 79 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/ca888899/slider-core/src/test/groovy/org/apache/slider/agent/standalone/TestStandaloneClusterNegativeComponentCounts.groovy
----------------------------------------------------------------------
diff --git 
a/slider-core/src/test/groovy/org/apache/slider/agent/standalone/TestStandaloneClusterNegativeComponentCounts.groovy
 
b/slider-core/src/test/groovy/org/apache/slider/agent/standalone/TestStandaloneClusterNegativeComponentCounts.groovy
new file mode 100644
index 0000000..8a23dc5
--- /dev/null
+++ 
b/slider-core/src/test/groovy/org/apache/slider/agent/standalone/TestStandaloneClusterNegativeComponentCounts.groovy
@@ -0,0 +1,79 @@
+/*
+ * 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.agent.standalone
+
+import groovy.transform.CompileStatic
+import groovy.util.logging.Slf4j
+import org.apache.hadoop.yarn.api.records.ApplicationReport
+import org.apache.hadoop.yarn.api.records.FinalApplicationStatus
+import org.apache.hadoop.yarn.api.records.YarnApplicationState
+import org.apache.hadoop.yarn.conf.YarnConfiguration
+import org.apache.slider.agent.AgentMiniClusterTestBase
+import org.apache.slider.api.InternalKeys
+import org.apache.slider.client.SliderClient
+import org.apache.slider.common.SliderXmlConfKeys
+import org.apache.slider.common.params.Arguments
+import org.apache.slider.core.main.ServiceLauncher
+import org.junit.Test
+
+@CompileStatic
+@Slf4j
+class TestStandaloneClusterNegativeComponentCounts
+    extends AgentMiniClusterTestBase {
+
+  @Test
+  public void testStandaloneClusterNegativeComponentCounts() throws Throwable {
+    describe "Run a Standalone AM with cluster counts set to 0 ... expect 
failures"
+    // patch the configuration for AM restart
+    int threshold = 2;
+    YarnConfiguration conf = getRestartableConfiguration(threshold)
+
+    String clustername = createMiniCluster("", conf, 1, true)
+    if (hdfsCluster) {
+      fail("Agent tests do not (currently) work with mini HDFS cluster")
+    }
+    ServiceLauncher<SliderClient> launcher =
+        createCluster(clustername,
+            ["negative":-4],
+            [
+            ],
+            true,
+            false,
+            agentDefOptions)
+    SliderClient sliderClient = launcher.service
+    addToTeardown(sliderClient);
+
+    ApplicationReport report
+    report = waitForClusterLive(sliderClient, 30000)
+  }
+
+  /**
+   * Get a restartable configuration
+   * @param restarts
+   * @return
+   */
+  public YarnConfiguration getRestartableConfiguration(int restarts) {
+    def conf = new YarnConfiguration(configuration)
+    conf.setInt(YarnConfiguration.RM_AM_MAX_ATTEMPTS, restarts)
+    conf.setInt(SliderXmlConfKeys.KEY_AM_RESTART_LIMIT, restarts)
+    conf
+  }
+
+
+}

Reply via email to