SLIDER-782 improving tests with better printing
Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/c8ddd608 Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/c8ddd608 Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/c8ddd608 Branch: refs/heads/develop Commit: c8ddd608120060ee9b017e735a66ae9f67d91a24 Parents: ef6fb9e Author: Steve Loughran <[email protected]> Authored: Fri Feb 13 20:33:59 2015 +0000 Committer: Steve Loughran <[email protected]> Committed: Fri Feb 13 20:33:59 2015 +0000 ---------------------------------------------------------------------- .../slider/api/types/ComponentInformation.java | 23 ++++++++++++++++++++ .../rest/AbstractAppApiTestDelegates.groovy | 17 ++++++++------- 2 files changed, 32 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/c8ddd608/slider-core/src/main/java/org/apache/slider/api/types/ComponentInformation.java ---------------------------------------------------------------------- diff --git a/slider-core/src/main/java/org/apache/slider/api/types/ComponentInformation.java b/slider-core/src/main/java/org/apache/slider/api/types/ComponentInformation.java index ce36922..286c3a1 100644 --- a/slider-core/src/main/java/org/apache/slider/api/types/ComponentInformation.java +++ b/slider-core/src/main/java/org/apache/slider/api/types/ComponentInformation.java @@ -60,4 +60,27 @@ public class ComponentInformation { return stats; } + @Override + public String toString() { + final StringBuilder sb = + new StringBuilder("ComponentInformation{"); + sb.append("failureMessage='").append(failureMessage).append('\''); + sb.append(", totalRequested=").append(totalRequested); + sb.append(", completed=").append(completed); + sb.append(", startFailed=").append(startFailed); + sb.append(", started=").append(started); + sb.append(", failed=").append(failed); + sb.append(", requested=").append(requested); + sb.append(", placementPolicy=").append(placementPolicy); + sb.append(", releasing=").append(releasing); + sb.append(", actual=").append(actual); + sb.append(", desired=").append(desired); + sb.append(", priority=").append(priority); + sb.append(", name='").append(name).append('\''); + sb.append(", container count='") + .append(containers== null ? 0: containers.size()) + .append('\''); + sb.append('}'); + return sb.toString(); + } } http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/c8ddd608/slider-core/src/test/groovy/org/apache/slider/agent/rest/AbstractAppApiTestDelegates.groovy ---------------------------------------------------------------------- diff --git a/slider-core/src/test/groovy/org/apache/slider/agent/rest/AbstractAppApiTestDelegates.groovy b/slider-core/src/test/groovy/org/apache/slider/agent/rest/AbstractAppApiTestDelegates.groovy index 0310be5..aaa0fd6 100644 --- a/slider-core/src/test/groovy/org/apache/slider/agent/rest/AbstractAppApiTestDelegates.groovy +++ b/slider-core/src/test/groovy/org/apache/slider/agent/rest/AbstractAppApiTestDelegates.groovy @@ -68,7 +68,7 @@ public abstract class AbstractAppApiTestDelegates extends AbstractRestTestDelega } public void testLiveResources() throws Throwable { - describe "Live Resources" + describe "Live Resources via $appAPI" ConfTreeOperations tree = appAPI.getLiveResources() @@ -87,7 +87,7 @@ public abstract class AbstractAppApiTestDelegates extends AbstractRestTestDelega public void testLiveContainers() throws Throwable { - describe "Application REST /live/containers" + describe "Application /live/containers from $appAPI" Map<String, ContainerInformation> containers = appAPI.enumContainers() assert containers.size() == 1 @@ -106,7 +106,7 @@ public abstract class AbstractAppApiTestDelegates extends AbstractRestTestDelega assert amContainerInfo.released == null assert amContainerInfo.state == StateValues.STATE_LIVE - describe "containers" + describe "containers via $appAPI" ContainerInformation amContainerInfo2 = appAPI.getContainer(amContainerId) @@ -121,7 +121,7 @@ public abstract class AbstractAppApiTestDelegates extends AbstractRestTestDelega } - describe "components" + describe "components via $appAPI" Map<String, ComponentInformation> components = appAPI.enumComponents() @@ -145,7 +145,7 @@ public abstract class AbstractAppApiTestDelegates extends AbstractRestTestDelega * @param appmaster */ public void testRESTModel() { - describe "model" + describe "model via $appAPI" def unresolvedConf = appAPI.getDesiredModel() // log.info "Unresolved \n$unresolvedConf" @@ -170,7 +170,7 @@ public abstract class AbstractAppApiTestDelegates extends AbstractRestTestDelega public void testPing() { // GET - describe "pinging" + describe "pinging via $appAPI" appAPI.ping("hello") } @@ -194,9 +194,10 @@ public abstract class AbstractAppApiTestDelegates extends AbstractRestTestDelega } public void testAppLiveness() { + describe "Liveness: check via $appAPI" def liveness = appAPI.applicationLiveness describe "Liveness:\n$liveness" - + assert liveness.allRequestsSatisfied assert !liveness.requestsOutstanding } @@ -210,7 +211,7 @@ public abstract class AbstractAppApiTestDelegates extends AbstractRestTestDelega try { appAPI.getApplicationLiveness() return Outcome.Retry - } catch (IOException expected) { + } catch (IOException success) { // expected return Outcome.Success }
