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/06/26 22:46:06 UTC

[3/4] git commit: SLIDER-96. Fixes to some tests.

SLIDER-96. Fixes to some tests.


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

Branch: refs/heads/develop
Commit: 78a1364b1c52453f029d3afdedfd1fc6e9fb6ebb
Parents: b64e1cd
Author: Sumit Mohanty <sm...@hortonworks.com>
Authored: Thu Jun 26 07:21:28 2014 -0700
Committer: Sumit Mohanty <sm...@hortonworks.com>
Committed: Thu Jun 26 13:41:31 2014 -0700

----------------------------------------------------------------------
 .../slider/providers/agent/AgentTestBase.groovy |  2 +-
 .../providers/agent/TestBuildBasicAgent.groovy  | 73 ++++++++++----------
 2 files changed, 36 insertions(+), 39 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/78a1364b/slider-core/src/test/groovy/org/apache/slider/providers/agent/AgentTestBase.groovy
----------------------------------------------------------------------
diff --git a/slider-core/src/test/groovy/org/apache/slider/providers/agent/AgentTestBase.groovy b/slider-core/src/test/groovy/org/apache/slider/providers/agent/AgentTestBase.groovy
index bb3eabe..9b4c377 100644
--- a/slider-core/src/test/groovy/org/apache/slider/providers/agent/AgentTestBase.groovy
+++ b/slider-core/src/test/groovy/org/apache/slider/providers/agent/AgentTestBase.groovy
@@ -47,7 +47,7 @@ public abstract class AgentTestBase extends YarnZKMiniClusterTestBase {
   @Rule
   public TemporaryFolder folder = new TemporaryFolder();
 
-  public static String app_def_pkg_path;
+  public String app_def_pkg_path;
 
   @Before
   public void setupAppPkg() {

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/78a1364b/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 1879f84..9f44888 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
@@ -38,34 +38,31 @@ import static org.apache.slider.providers.agent.AgentKeys.*
 @Slf4j
 class TestBuildBasicAgent extends AgentTestBase {
   static String TEST_FILES = "./src/test/resources/org/apache/slider/providers/agent/tests/"
+  static File slider_core = new File(new File(".").absoluteFile, "src/test/python");
+  static String bad_app_def = "appdef_1.tar"
+  static File bad_app_def_path = new File(slider_core, bad_app_def)
+  static String agt_conf = "agent.ini"
+  static File agt_conf_path = new File(slider_core, agt_conf)
 
   @Override
   void checkTestAssumptions(YarnConfiguration conf) {
 
   }
 
-  private static class TestResources {
-    static File slider_core = new File(new File(".").absoluteFile, "src/test/python");
-    static String bad_app_def = "appdef_1.tar"
-    static File bad_app_def_path = new File(slider_core, bad_app_def)
-    static String agt_conf = "agent.ini"
-    static File agt_conf_path = new File(slider_core, agt_conf)
-
-    public static File getAppDef() {
-      return new File(app_def_pkg_path);
-    }
+  private File getAppDef() {
+    return new File(app_def_pkg_path);
+  }
 
-    public static File getBadAppDef() {
-      return bad_app_def_path;
-    }
+  private File getBadAppDef() {
+    return bad_app_def_path;
+  }
 
-    public static File getAgentConf() {
-      return agt_conf_path;
-    }
+  private File getAgentConf() {
+    return agt_conf_path;
+  }
 
-    public static File getAgentImg() {
-      return new File(app_def_pkg_path);
-    }
+  private File getAgentImg() {
+    return new File(app_def_pkg_path);
   }
 
 
@@ -86,8 +83,8 @@ class TestBuildBasicAgent extends AgentTestBase {
         [
             ARG_OPTION, CONTROLLER_URL, "http://localhost",
             ARG_PACKAGE, ".",
-            ARG_OPTION, APP_DEF, "file://" + TestResources.getAppDef().absolutePath,
-            ARG_OPTION, AGENT_CONF, "file://" + TestResources.getAgentConf().absolutePath,
+            ARG_OPTION, APP_DEF, "file://" + getAppDef().absolutePath,
+            ARG_OPTION, AGENT_CONF, "file://" + getAgentConf().absolutePath,
             ARG_OPTION, SCRIPT_PATH, "agent/scripts/agent.py",
             ARG_COMP_OPT, ROLE_NODE, SCRIPT_PATH, "agent/scripts/agent.py",
             ARG_RES_COMP_OPT, ROLE_NODE, ResourceKeys.COMPONENT_PRIORITY, "1",
@@ -106,8 +103,8 @@ class TestBuildBasicAgent extends AgentTestBase {
         [
             ARG_OPTION, CONTROLLER_URL, "http://localhost",
             ARG_OPTION, PACKAGE_PATH, ".",
-            ARG_OPTION, APP_DEF, "file://" + TestResources.getAppDef().absolutePath,
-            ARG_OPTION, AGENT_CONF, "file://" + TestResources.getAgentConf().absolutePath,
+            ARG_OPTION, APP_DEF, "file://" + getAppDef().absolutePath,
+            ARG_OPTION, AGENT_CONF, "file://" + getAgentConf().absolutePath,
             ARG_COMP_OPT, master, SCRIPT_PATH, "agent/scripts/agent.py",
             ARG_COMP_OPT, rs, SCRIPT_PATH, "agent/scripts/agent.py",
             ARG_RES_COMP_OPT, master, ResourceKeys.COMPONENT_PRIORITY, "2",
@@ -188,8 +185,8 @@ class TestBuildBasicAgent extends AgentTestBase {
             (rs): 5
         ],
         [
-            ARG_OPTION, APP_DEF, "file://" + TestResources.getAppDef().absolutePath,
-            ARG_OPTION, AGENT_CONF, "file://" + TestResources.getAgentConf().absolutePath,
+            ARG_OPTION, APP_DEF, "file://" + getAppDef().absolutePath,
+            ARG_OPTION, AGENT_CONF, "file://" + getAgentConf().absolutePath,
             ARG_PACKAGE, ".",
             ARG_COMP_OPT, SliderKeys.COMPONENT_AM, RoleKeys.JVM_OPTS, jvmopts,
             ARG_COMP_OPT, master, RoleKeys.JVM_OPTS, jvmopts,
@@ -218,8 +215,8 @@ class TestBuildBasicAgent extends AgentTestBase {
             "role": 1,
         ],
         [
-            ARG_OPTION, APP_DEF, "file://" + TestResources.getAppDef().absolutePath,
-            ARG_OPTION, AGENT_CONF, "file://" + TestResources.getAgentConf().absolutePath,
+            ARG_OPTION, APP_DEF, "file://" + getAppDef().absolutePath,
+            ARG_OPTION, AGENT_CONF, "file://" + getAgentConf().absolutePath,
             ARG_PACKAGE, ".",
             ARG_RES_COMP_OPT, "role", ResourceKeys.COMPONENT_PRIORITY, "3",
         ],
@@ -255,8 +252,8 @@ class TestBuildBasicAgent extends AgentTestBase {
           [:],
           [
               ARG_OPTION, CONTROLLER_URL, "http://localhost",
-              ARG_OPTION, APP_DEF, "file://" + TestResources.getAppDef().absolutePath,
-              ARG_OPTION, AGENT_CONF, "file://" + TestResources.getAgentConf().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"
           ],
@@ -273,9 +270,9 @@ class TestBuildBasicAgent extends AgentTestBase {
           [:],
           [
               ARG_OPTION, CONTROLLER_URL, "http://localhost",
-              ARG_IMAGE, "file://" + TestResources.getAgentImg().absolutePath + ".badfile",
-              ARG_OPTION, APP_DEF, "file://" + TestResources.getAppDef().absolutePath,
-              ARG_OPTION, AGENT_CONF, "file://" + TestResources.getAgentConf().absolutePath,
+              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",
               ARG_TEMPLATE, TEST_FILES + "good/appconf.json"
           ],
@@ -291,7 +288,7 @@ class TestBuildBasicAgent extends AgentTestBase {
           [:],
           [
               ARG_OPTION, CONTROLLER_URL, "http://localhost",
-              ARG_OPTION, AGENT_CONF, "file://" + TestResources.getAgentConf().absolutePath,
+              ARG_OPTION, AGENT_CONF, "file://" + getAgentConf().absolutePath,
               ARG_RESOURCES, TEST_FILES + "good/resources.json",
               ARG_TEMPLATE, TEST_FILES + "good/appconf.json"
           ],
@@ -308,7 +305,7 @@ class TestBuildBasicAgent extends AgentTestBase {
           [
               ARG_OPTION, CONTROLLER_URL, "http://localhost",
               ARG_PACKAGE, ".",
-              ARG_OPTION, APP_DEF, "file://" + TestResources.getAppDef().absolutePath,
+              ARG_OPTION, APP_DEF, "file://" + getAppDef().absolutePath,
               ARG_RESOURCES, TEST_FILES + "good/resources.json",
               ARG_TEMPLATE, TEST_FILES + "good/appconf.json"
           ],
@@ -324,9 +321,9 @@ class TestBuildBasicAgent extends AgentTestBase {
           [:],
           [
               ARG_OPTION, CONTROLLER_URL, "http://localhost",
-              ARG_OPTION, AGENT_CONF, "file://" + TestResources.getAgentConf().absolutePath,
+              ARG_OPTION, AGENT_CONF, "file://" + getAgentConf().absolutePath,
               ARG_PACKAGE, ".",
-              ARG_OPTION, APP_DEF, "file://" + TestResources.getBadAppDef().absolutePath,
+              ARG_OPTION, APP_DEF, "file://" + getBadAppDef().absolutePath,
               ARG_RESOURCES, TEST_FILES + "good/resources.json",
               ARG_TEMPLATE, TEST_FILES + "good/appconf.json"
           ],
@@ -356,8 +353,8 @@ class TestBuildBasicAgent extends AgentTestBase {
         [:],
         [
             ARG_OPTION, CONTROLLER_URL, "http://localhost",
-            ARG_OPTION, APP_DEF, "file://" + TestResources.getAppDef().absolutePath,
-            ARG_OPTION, AGENT_CONF, "file://" + TestResources.getAgentConf().absolutePath,
+            ARG_OPTION, APP_DEF, "file://" + getAppDef().absolutePath,
+            ARG_OPTION, AGENT_CONF, "file://" + getAgentConf().absolutePath,
             ARG_PACKAGE, ".",
             ARG_RESOURCES, TEST_FILES + "good/resources.json",
             ARG_TEMPLATE, TEST_FILES + "good/appconf.json"