You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@slider.apache.org by sm...@apache.org on 2014/07/09 05:30:25 UTC

git commit: SLIDER-218. Unit Test failure causing build failure (Gour Saha via smohanty)

Repository: incubator-slider
Updated Branches:
  refs/heads/develop 32c7ea98a -> 3427b6e13


SLIDER-218. Unit Test failure causing build failure (Gour Saha via smohanty)


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

Branch: refs/heads/develop
Commit: 3427b6e134bf1cb8a64e40fa840fc816663af48d
Parents: 32c7ea9
Author: Sumit Mohanty <sm...@hortonworks.com>
Authored: Tue Jul 8 20:30:02 2014 -0700
Committer: Sumit Mohanty <sm...@hortonworks.com>
Committed: Tue Jul 8 20:30:02 2014 -0700

----------------------------------------------------------------------
 .../providers/agent/TestBuildBasicAgent.groovy  | 59 +++++++++++++-------
 1 file changed, 40 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/3427b6e1/slider-core/src/test/groovy/org/apache/slider/providers/agent/TestBuildBasicAgent.groovy
----------------------------------------------------------------------
diff --git a/slider-core/src/test/groovy/org/apache/slider/providers/agent/TestBuildBasicAgent.groovy b/slider-core/src/test/groovy/org/apache/slider/providers/agent/TestBuildBasicAgent.groovy
index 9f44888..421920f 100644
--- a/slider-core/src/test/groovy/org/apache/slider/providers/agent/TestBuildBasicAgent.groovy
+++ b/slider-core/src/test/groovy/org/apache/slider/providers/agent/TestBuildBasicAgent.groovy
@@ -235,8 +235,8 @@ class TestBuildBasicAgent extends AgentTestBase {
   }
 
   @Test
-  public void testBadAgentArgs() throws Throwable {
-    def clustername = "test_bad_template_args"
+  public void testAgentArgs() throws Throwable {
+    def clustername = "test_good_agent_args"
     createMiniCluster(
         clustername,
         configuration,
@@ -247,30 +247,43 @@ class TestBuildBasicAgent extends AgentTestBase {
         false)
 
     try {
-      def badArgs1 = "test_bad_agent_args-1"
+      def badArgs1 = "test_good_agent_args-1"
       buildAgentCluster(clustername,
           [:],
           [
               ARG_OPTION, CONTROLLER_URL, "http://localhost",
+              ARG_PACKAGE, ".",
               ARG_OPTION, APP_DEF, "file://" + getAppDef().absolutePath,
-              ARG_OPTION, AGENT_CONF, "file://" + getAgentConf().absolutePath,
               ARG_RESOURCES, TEST_FILES + "good/resources.json",
               ARG_TEMPLATE, TEST_FILES + "good/appconf.json"
           ],
           true, false,
           false)
-      failWithBuildSucceeding(badArgs1, "missing package home or image path")
-    } catch (BadConfigException expected) {
-
+    } catch (BadConfigException exception) {
+      log.error(
+          "Build operation should not have failed with exception : \n$exception")
+      fail("Build operation should not fail")
     }
+  }
+  
+  @Test
+  public void testBadAgentArgs() throws Throwable {
+    def clustername = "test_bad_agent_args"
+    createMiniCluster(
+        clustername,
+        configuration,
+        1,
+        1,
+        1,
+        true,
+        false)
 
     try {
-      def badArgs1 = "test_bad_agent_args-2"
-      buildAgentCluster(clustername,
+      def badArgs1 = "test_bad_agent_args-1"
+      buildAgentCluster(badArgs1,
           [:],
           [
               ARG_OPTION, CONTROLLER_URL, "http://localhost",
-              ARG_IMAGE, "file://" + getAgentImg().absolutePath + ".badfile",
               ARG_OPTION, APP_DEF, "file://" + getAppDef().absolutePath,
               ARG_OPTION, AGENT_CONF, "file://" + getAgentConf().absolutePath,
               ARG_RESOURCES, TEST_FILES + "good/resources.json",
@@ -278,46 +291,54 @@ class TestBuildBasicAgent extends AgentTestBase {
           ],
           true, false,
           false)
-      failWithBuildSucceeding(badArgs1, "bad image path")
+      failWithBuildSucceeding(badArgs1, "missing package home or image path")
     } catch (BadConfigException expected) {
+      log.info("Expected failure.", expected)
+      assert expected.message.contains("Either agent package path agent.package.root or image root internal.application.image.path must be provided")
     }
 
     try {
-      def badArgs1 = "test_bad_agent_args-3"
-      buildAgentCluster(clustername,
+      def badArgs1 = "test_bad_agent_args-2"
+      buildAgentCluster(badArgs1,
           [:],
           [
               ARG_OPTION, CONTROLLER_URL, "http://localhost",
+              ARG_IMAGE, "file://" + getAgentImg().absolutePath,
+              ARG_OPTION, APP_DEF, "file://" + getAppDef().absolutePath,
               ARG_OPTION, AGENT_CONF, "file://" + getAgentConf().absolutePath,
               ARG_RESOURCES, TEST_FILES + "good/resources.json",
               ARG_TEMPLATE, TEST_FILES + "good/appconf.json"
           ],
           true, false,
           false)
-      failWithBuildSucceeding(badArgs1, "bad app def file")
+      failWithBuildSucceeding(badArgs1, "both app image path and home dir was provided")
     } catch (BadConfigException expected) {
+      log.info("Expected failure.", expected)
+      assert expected.message.contains("Both application image path and home dir have been provided")
     }
 
     try {
-      def badArgs1 = "test_bad_agent_args-5"
-      buildAgentCluster(clustername,
+      def badArgs1 = "test_bad_agent_args-3"
+      buildAgentCluster(badArgs1,
           [:],
           [
               ARG_OPTION, CONTROLLER_URL, "http://localhost",
+              ARG_OPTION, AGENT_CONF, "file://" + getAgentConf().absolutePath,
               ARG_PACKAGE, ".",
-              ARG_OPTION, APP_DEF, "file://" + getAppDef().absolutePath,
               ARG_RESOURCES, TEST_FILES + "good/resources.json",
               ARG_TEMPLATE, TEST_FILES + "good/appconf.json"
           ],
           true, false,
           false)
-      failWithBuildSucceeding(badArgs1, "bad agent conf file")
+      failWithBuildSucceeding(badArgs1, "missing app def file")
     } catch (BadConfigException expected) {
+      log.info("Expected failure.", expected)
+      assert expected.message.contains("Application definition must be provided. Missing option application.def")
     }
 
     try {
       def badArgs1 = "test_bad_agent_args-6"
-      buildAgentCluster(clustername,
+      buildAgentCluster(badArgs1,
           [:],
           [
               ARG_OPTION, CONTROLLER_URL, "http://localhost",