SLIDER-797 AppsThroughAgentIT to spin longer for AM resolution, and report 
error text on timeout


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

Branch: refs/heads/develop
Commit: 0b286889abbd3613af824341b108e2feaf0dd57f
Parents: 14365ee
Author: Steve Loughran <[email protected]>
Authored: Thu Feb 26 16:35:30 2015 -0800
Committer: Steve Loughran <[email protected]>
Committed: Thu Feb 26 16:35:30 2015 -0800

----------------------------------------------------------------------
 .../funtest/framework/CommandTestBase.groovy    | 21 +++++++++++++++-----
 .../funtest/lifecycle/AppsThroughAgentIT.groovy | 10 ++++++++--
 2 files changed, 24 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/0b286889/slider-funtest/src/main/groovy/org/apache/slider/funtest/framework/CommandTestBase.groovy
----------------------------------------------------------------------
diff --git 
a/slider-funtest/src/main/groovy/org/apache/slider/funtest/framework/CommandTestBase.groovy
 
b/slider-funtest/src/main/groovy/org/apache/slider/funtest/framework/CommandTestBase.groovy
index 4871ef8..95021b8 100644
--- 
a/slider-funtest/src/main/groovy/org/apache/slider/funtest/framework/CommandTestBase.groovy
+++ 
b/slider-funtest/src/main/groovy/org/apache/slider/funtest/framework/CommandTestBase.groovy
@@ -93,8 +93,8 @@ abstract class CommandTestBase extends SliderTestUtils {
    */
   public static final String TILDE
   public static final int CONTAINER_LAUNCH_TIMEOUT = 90000
-  public static final int PROBE_SLEEP_TIME = 4000
-  public static final int REGISTRY_STARTUP_TIMEOUT = 60000
+  public static final int PROBE_SLEEP_TIME = 2000
+  public static final int REGISTRY_STARTUP_TIMEOUT = 90000
   public static final String E_LAUNCH_FAIL = 'Application did not start'
 
   /*
@@ -828,17 +828,28 @@ abstract class CommandTestBase extends SliderTestUtils {
   /**
    * Spinning operation to perform a registry call
    * @param application application
+   * @param target target URL For diagnostics
    */
-  protected void ensureRegistryCallSucceeds(String application) {
+  protected void ensureRegistryCallSucceeds(String application, URL target) {
+    def failureText = "Application registry is not accessible at $target after 
$REGISTRY_STARTUP_TIMEOUT ms"
     repeatUntilSuccess("registry",
         this.&isRegistryAccessible,
         REGISTRY_STARTUP_TIMEOUT,
         PROBE_SLEEP_TIME,
         [application: application],
         true,
-        "Application registry is not accessible after 
$REGISTRY_STARTUP_TIMEOUT") {
-      describe "Not able to access registry after after 
$REGISTRY_STARTUP_TIMEOUT"
+        failureText) {
+      describe failureText
       exists(application, true).dumpOutput()
+      if (target != null) {
+        // GET the text of the target if provided
+        def body = target.text
+        def errorText = "Registry probe to $target failed with 
response:\n$body"
+        log.error(errorText)
+        fail(errorText)
+      }
+
+      // trigger a failure on registry lookup
       SliderShell shell = registry(0, [
               ARG_NAME,
               application,

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/0b286889/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AppsThroughAgentIT.groovy
----------------------------------------------------------------------
diff --git 
a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AppsThroughAgentIT.groovy
 
b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AppsThroughAgentIT.groovy
index 8b15a0c..0db775b 100644
--- 
a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AppsThroughAgentIT.groovy
+++ 
b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AppsThroughAgentIT.groovy
@@ -26,6 +26,7 @@ import org.apache.slider.common.params.SliderActions
 import org.apache.slider.funtest.framework.AgentCommandTestBase
 import org.apache.slider.funtest.framework.FuntestProperties
 import org.apache.slider.funtest.framework.SliderShell
+import org.apache.slider.server.appmaster.web.rest.RestPaths
 import org.junit.After
 import org.junit.Before
 import org.junit.Test
@@ -86,9 +87,14 @@ implements FuntestProperties, Arguments, SliderExitCodes, 
SliderActions {
 
     String amWebUrl = getInfoAmWebUrl(application)
     log.info("Dumping data from AM Web URL");
-    log.info(amWebUrl.toURL().text);
 
-    ensureRegistryCallSucceeds(application)
+    def appmasterURL = amWebUrl.toURL()
+    log.info(appmasterURL.text);
+    URL registryExportsURL = new URL(appmasterURL,
+        RestPaths.SLIDER_PATH_PUBLISHER
+            + "/" + RestPaths.SLIDER_EXPORTS)
+
+    ensureRegistryCallSucceeds(application, registryExportsURL)
     assertAppRunning(appId)
     def outfile = tmpFile(".txt")
 

Reply via email to