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/10/28 17:45:25 UTC

git commit: SLIDER-565 break up assertions to check for into one per test case

Repository: incubator-slider
Updated Branches:
  refs/heads/develop fa626f3d7 -> bb76e00e8


SLIDER-565 break up assertions to check for into one per test case


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

Branch: refs/heads/develop
Commit: bb76e00e897fd5c840af648f8548f43fc2bd24be
Parents: fa626f3
Author: Steve Loughran <st...@apache.org>
Authored: Tue Oct 28 16:45:14 2014 +0000
Committer: Steve Loughran <st...@apache.org>
Committed: Tue Oct 28 16:45:14 2014 +0000

----------------------------------------------------------------------
 .../commands/CommandEnvironmentIT.groovy        | 56 +++++++++++++++-----
 1 file changed, 43 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/bb76e00e/slider-funtest/src/test/groovy/org/apache/slider/funtest/commands/CommandEnvironmentIT.groovy
----------------------------------------------------------------------
diff --git a/slider-funtest/src/test/groovy/org/apache/slider/funtest/commands/CommandEnvironmentIT.groovy b/slider-funtest/src/test/groovy/org/apache/slider/funtest/commands/CommandEnvironmentIT.groovy
index 7680e49..2974b10 100644
--- a/slider-funtest/src/test/groovy/org/apache/slider/funtest/commands/CommandEnvironmentIT.groovy
+++ b/slider-funtest/src/test/groovy/org/apache/slider/funtest/commands/CommandEnvironmentIT.groovy
@@ -33,6 +33,8 @@ import org.junit.Test
 @Slf4j
 public class CommandEnvironmentIT extends CommandTestBase {
 
+  public static final String TESTPROPERTY_SET_IN_FUNTEST = "testpropertySetInFuntest"
+  public static final String TEST_PROPERTY_VALUE = "TestPropertyValue"
   File originalScript
   
   @Before
@@ -47,31 +49,59 @@ public class CommandEnvironmentIT extends CommandTestBase {
 
   @Test
   public void testJVMOptionPassdownBash() throws Throwable {
-    assume(!SliderShell.windows, "skip bash test on windows")
-    SliderShell.scriptFile = SLIDER_SCRIPT;
-    execScriptTest()
+    SliderShell shell = diagnostics(false)
+    assertOutputContains(shell, TESTPROPERTY_SET_IN_FUNTEST, 2)
+    assertOutputContains(shell, TEST_PROPERTY_VALUE, 2)
   }
 
   @Test
   public void testJVMOptionPassdownPython() throws Throwable {
-    SliderShell.scriptFile = SLIDER_SCRIPT_PYTHON;
-    execScriptTest()
+    SliderShell shell = diagnostics(true)
+    assertOutputContains(shell, TESTPROPERTY_SET_IN_FUNTEST, 2)
+    assertOutputContains(shell, TEST_PROPERTY_VALUE, 2)
   }
 
-  public void execScriptTest() {
+  @Test
+  public void testLibdirPython() throws Throwable {
+    SliderShell shell = diagnostics(true)
+    assertOutputContains(shell, SliderKeys.PROPERTY_LIB_DIR)
+  }
+
+  @Test
+  public void testLibdirBash() throws Throwable {
+    SliderShell shell = diagnostics(false)
+    assertOutputContains(shell, SliderKeys.PROPERTY_LIB_DIR)
+  }
+
+
+  @Test
+  public void testConfdirPython() throws Throwable {
+    SliderShell shell = diagnostics(true)
+    assertOutputContains(shell, SliderKeys.PROPERTY_CONF_DIR)
+  }
+
+  @Test
+  public void testConfdirBash() throws Throwable {
+    SliderShell shell = diagnostics(false)
+    assertOutputContains(shell, SliderKeys.PROPERTY_CONF_DIR)
+  }
+
+  public SliderShell diagnostics(boolean python) {
+    if (python) {
+      SliderShell.scriptFile = SLIDER_SCRIPT_PYTHON;
+    } else {
+      assume(!SliderShell.windows, "skip bash test on windows")
+      SliderShell.scriptFile = SLIDER_SCRIPT;
+    }
     SliderShell shell = new SliderShell([
         SliderActions.ACTION_DIAGNOSTICS,
         Arguments.ARG_CLIENT,
         Arguments.ARG_VERBOSE
     ])
-    def name = "testpropertySetInFuntest"
-    def val = "TestPropertyValue"
-    shell.setEnv(SliderKeys.SLIDER_JVM_OPTS, "-D" + name + "=" + val)
+    shell.setEnv(SliderKeys.SLIDER_JVM_OPTS, 
+        "-D${TESTPROPERTY_SET_IN_FUNTEST}=${TEST_PROPERTY_VALUE}")
     shell.execute(0)
-    assertOutputContains(shell, name, 2)
-    assertOutputContains(shell, val, 2)
-    assertOutputContains(shell, SliderKeys.PROPERTY_LIB_DIR)
-    assertOutputContains(shell, SliderKeys.PROPERTY_CONF_DIR)
+    return shell
   }
 
 }