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 2014/06/03 14:14:35 UTC

[2/5] git commit: SLIDER-112 core test standalone agent AM tests failing

SLIDER-112 core test standalone agent AM tests failing


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

Branch: refs/heads/develop
Commit: bf4cf2c773a716503d8ac2343bade87ef2494b3b
Parents: 272af14
Author: Steve Loughran <st...@apache.org>
Authored: Tue Jun 3 13:02:13 2014 +0100
Committer: Steve Loughran <st...@apache.org>
Committed: Tue Jun 3 13:02:13 2014 +0100

----------------------------------------------------------------------
 .../agent/actions/TestActionExists.groovy       |  4 +--
 .../slider/agent/actions/TestActionList.groovy  |  6 ++--
 .../slider/test/YarnMiniClusterTestBase.groovy  | 35 ++++++++++++++++----
 .../test/YarnZKMiniClusterTestBase.groovy       |  4 ++-
 4 files changed, 36 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/bf4cf2c7/slider-core/src/test/groovy/org/apache/slider/agent/actions/TestActionExists.groovy
----------------------------------------------------------------------
diff --git a/slider-core/src/test/groovy/org/apache/slider/agent/actions/TestActionExists.groovy b/slider-core/src/test/groovy/org/apache/slider/agent/actions/TestActionExists.groovy
index fefed8e..c982659 100644
--- a/slider-core/src/test/groovy/org/apache/slider/agent/actions/TestActionExists.groovy
+++ b/slider-core/src/test/groovy/org/apache/slider/agent/actions/TestActionExists.groovy
@@ -71,7 +71,7 @@ class TestActionExists extends AgentMiniClusterTestBase {
   @Test
   public void testExistsLiveCluster() throws Throwable {
     //launch the cluster
-    String clustername = "testExistsLiveCluster"
+    String clustername = createClusterName()
     ServiceLauncher launcher = createMasterlessAM(clustername, 0, true, false)
     SliderClient sliderClient = launcher.service
     addToTeardown(launcher)
@@ -88,7 +88,7 @@ class TestActionExists extends AgentMiniClusterTestBase {
           Arguments.ARG_MANAGER, RMAddr
           ],
       )
-    SliderTestUtils.assertSucceeded(launcher)
+    assertSucceeded(launcher)
 
     //and when cluster is running
     launcher = launchClientAgainstMiniMR(

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/bf4cf2c7/slider-core/src/test/groovy/org/apache/slider/agent/actions/TestActionList.groovy
----------------------------------------------------------------------
diff --git a/slider-core/src/test/groovy/org/apache/slider/agent/actions/TestActionList.groovy b/slider-core/src/test/groovy/org/apache/slider/agent/actions/TestActionList.groovy
index 1849807..b1963dc 100644
--- a/slider-core/src/test/groovy/org/apache/slider/agent/actions/TestActionList.groovy
+++ b/slider-core/src/test/groovy/org/apache/slider/agent/actions/TestActionList.groovy
@@ -40,7 +40,7 @@ class TestActionList extends AgentMiniClusterTestBase {
   @Before
   public void setup() {
     super.setup()
-    createMiniCluster("testActionList", configuration, 1, false)
+    createMiniCluster("test_action_list", configuration, 1, false)
   }
 
   /**
@@ -87,7 +87,7 @@ class TestActionList extends AgentMiniClusterTestBase {
 
   public void testListLiveCluster() throws Throwable {
     //launch the cluster
-    String clustername = "test_list_live_cluster"
+    String clustername = createClusterName()
     ServiceLauncher<SliderClient> launcher = createMasterlessAM(clustername, 0, true, false)
     addToTeardown(launcher)
     //do the low level operations to get a better view of what is going on 
@@ -135,7 +135,7 @@ class TestActionList extends AgentMiniClusterTestBase {
           //varargs list of command line params
           [
               SliderActions.ACTION_LIST,
-              "testStatusMissingCluster"
+              "teststatusmissingcluster"
           ]
       )
       fail("expected an exception, got a status code " + launcher.serviceExitCode)

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/bf4cf2c7/slider-core/src/test/groovy/org/apache/slider/test/YarnMiniClusterTestBase.groovy
----------------------------------------------------------------------
diff --git a/slider-core/src/test/groovy/org/apache/slider/test/YarnMiniClusterTestBase.groovy b/slider-core/src/test/groovy/org/apache/slider/test/YarnMiniClusterTestBase.groovy
index 6a92047..e5715b1 100644
--- a/slider-core/src/test/groovy/org/apache/slider/test/YarnMiniClusterTestBase.groovy
+++ b/slider-core/src/test/groovy/org/apache/slider/test/YarnMiniClusterTestBase.groovy
@@ -48,12 +48,15 @@ import org.apache.slider.core.main.ServiceLauncher
 import org.apache.slider.core.main.ServiceLauncherBaseTest
 import org.apache.slider.server.appmaster.SliderAppMaster
 import org.junit.After
+import org.junit.Before
 import org.junit.Rule
+import org.junit.rules.TestName
 import org.junit.rules.Timeout
 
-import static org.apache.slider.common.SliderXMLConfKeysForTesting.*
 import static org.apache.slider.test.KeysForTests.*
 
+import static org.apache.slider.common.SliderKeys.*;
+import static org.apache.slider.common.SliderXMLConfKeysForTesting.*;
 /**
  * Base class for mini cluster tests -creates a field for the
  * mini yarn cluster
@@ -109,18 +112,13 @@ public abstract class YarnMiniClusterTestBase extends ServiceLauncherBaseTest {
   protected boolean switchToImageDeploy = false
   protected boolean imageIsRemote = false
   protected URI remoteImageURI
+  private int clusterCount =1;
 
   protected List<SliderClient> clustersToTeardown = [];
 
   /**
    * This is set in a system property
    */
-/*
-  @Rule
-  public Timeout testTimeout = new Timeout(1000* 
-      Integer.getInteger(KEY_TEST_TIMEOUT, DEFAULT_TEST_TIMEOUT))
-
-*/
 
   @Rule
   public Timeout testTimeout = new Timeout(
@@ -129,6 +127,29 @@ public abstract class YarnMiniClusterTestBase extends ServiceLauncherBaseTest {
           DEFAULT_TEST_TIMEOUT_SECONDS * 1000)
   )
 
+
+  @Rule
+  public TestName methodName = new TestName();
+
+  @Before
+  public void nameThread() {
+    Thread.currentThread().setName("JUnit");
+  }
+
+  /**
+   * Create the cluster name from the method name and an auto-incrementing
+   * counter.
+   * @return a cluster name
+   */
+  protected String createClusterName() {
+    def base = methodName.getMethodName().toLowerCase(Locale.ENGLISH)
+    if (clusterCount++>1) {
+      base += "-$clusterCount"
+    }
+    return base
+  }
+
+
   @Override
   void setup() {
     super.setup()

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/bf4cf2c7/slider-core/src/test/groovy/org/apache/slider/test/YarnZKMiniClusterTestBase.groovy
----------------------------------------------------------------------
diff --git a/slider-core/src/test/groovy/org/apache/slider/test/YarnZKMiniClusterTestBase.groovy b/slider-core/src/test/groovy/org/apache/slider/test/YarnZKMiniClusterTestBase.groovy
index 691cd2f..77d47f4 100644
--- a/slider-core/src/test/groovy/org/apache/slider/test/YarnZKMiniClusterTestBase.groovy
+++ b/slider-core/src/test/groovy/org/apache/slider/test/YarnZKMiniClusterTestBase.groovy
@@ -29,7 +29,9 @@ import org.apache.slider.core.zk.ZKIntegration
 
 import java.util.concurrent.atomic.AtomicBoolean
 
-import static org.apache.slider.test.KeysForTests.USERNAME
+import static org.apache.slider.common.SliderKeys.*;
+import static org.apache.slider.common.SliderXMLConfKeysForTesting.*;
+import static org.apache.slider.test.KeysForTests.*;
 
 /**
  * Base class for mini cluster tests that use Zookeeper