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/23 12:40:45 UTC
[06/10] git commit: SLIDER-460 test AgentFailuresIT working
SLIDER-460 test AgentFailuresIT working
Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/802ff46e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/802ff46e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/802ff46e
Branch: refs/heads/develop
Commit: 802ff46eeeb9881a2207c157030361cb2b57990d
Parents: 9c5ac0f
Author: Steve Loughran <st...@apache.org>
Authored: Thu Oct 23 11:17:54 2014 +0100
Committer: Steve Loughran <st...@apache.org>
Committed: Thu Oct 23 11:35:55 2014 +0100
----------------------------------------------------------------------
.../funtest/framework/CommandTestBase.groovy | 34 ++++++++++++--------
.../funtest/lifecycle/AMFailuresIT.groovy | 2 +-
.../funtest/lifecycle/AgentFailures2IT.groovy | 2 +-
.../funtest/lifecycle/AgentFailuresIT.groovy | 2 +-
.../AppsThroughAgentQueueAndLabelsIT.groovy | 4 +--
5 files changed, 26 insertions(+), 18 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/802ff46e/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 4b75c56..fb1a980 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
@@ -28,6 +28,7 @@ import org.apache.hadoop.util.ExitUtil
import org.apache.hadoop.util.Shell
import org.apache.hadoop.yarn.api.records.YarnApplicationState
import org.apache.hadoop.yarn.conf.YarnConfiguration
+import org.apache.slider.api.StatusKeys
import org.apache.slider.common.tools.ConfigHelper
import org.apache.slider.core.main.LauncherExitCodes
import org.apache.slider.core.main.ServiceLauncher
@@ -755,9 +756,7 @@ abstract class CommandTestBase extends SliderTestUtils {
])
assert statusFile.exists()
- cd = new ClusterDescription();
- cd.fromFile(statusFile)
- return cd
+ return ClusterDescription.fromFile(statusFile)
} finally {
statusFile.delete()
}
@@ -766,36 +765,45 @@ abstract class CommandTestBase extends SliderTestUtils {
public int queryRequestedCount(String application, String role) {
ClusterDescription cd = execStatus(application)
+ if (cd.statistics.size() == 0) {
+ log.debug("No statistics entries")
+ }
+
if (!cd.statistics[role]) {
+ log.debug("No stats for role $role")
return 0;
}
def statsForRole = cd.statistics[role]
- def requested = statsForRole["containers.requested"]
- assert null != statsForRole["containers.requested"]
- int requestedCount = requested
- return requestedCount
+ def requested = statsForRole[StatusKeys.STATISTICS_CONTAINERS_REQUESTED]
+ assert null != statsForRole[StatusKeys.STATISTICS_CONTAINERS_REQUESTED]
+ return requested
}
- boolean hasRequestedContainerCountExceeded(Map<String, String> args) {
+ boolean hasRequestedContainerCountReached(Map<String, String> args) {
String application = args['application']
String role = args['role']
int expectedCount = args['limit'].toInteger();
- return queryRequestedCount(application, role) >= expectedCount
+
+ int requestedCount = queryRequestedCount(application, role)
+ log.debug("requested count = $requestedCount; expected=$expectedCount")
+ return requestedCount >= expectedCount
}
- void expectContainerCountExceeded(String application, String role, int limit) {
+ void expectContainerRequestedCountReached(String application, String role, int limit) {
repeatUntilTrue(
- this.&hasRequestedContainerCountExceeded,
- 50,
- 1000 * 10,
+ this.&hasRequestedContainerCountReached,
+ 90,
+ 1000,
[limit : Integer.toString(limit),
role : role,
application: application],
true,
"countainer count not reached") {
describe "container count not reached"
+ ClusterDescription cd = execStatus(application);
+ log.info("Parsed status \n$cd")
status(application).dumpOutput()
};
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/802ff46e/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AMFailuresIT.groovy
----------------------------------------------------------------------
diff --git a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AMFailuresIT.groovy b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AMFailuresIT.groovy
index f36950f..10a3dfe 100644
--- a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AMFailuresIT.groovy
+++ b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AMFailuresIT.groovy
@@ -67,7 +67,7 @@ implements FuntestProperties, Arguments, SliderExitCodes, SliderActions {
logShell(shell)
ensureApplicationIsUp(APPLICATION_NAME)
- expectContainerCountExceeded(APPLICATION_NAME, COMMAND_LOGGER, 1)
+ expectContainerRequestedCountReached(APPLICATION_NAME, COMMAND_LOGGER, 1)
// Wait for 20 secs for AM and agent to both reach STARTED state
sleep(1000 * 20)
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/802ff46e/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentFailures2IT.groovy
----------------------------------------------------------------------
diff --git a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentFailures2IT.groovy b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentFailures2IT.groovy
index 9fd34f6..9b35fa4 100644
--- a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentFailures2IT.groovy
+++ b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentFailures2IT.groovy
@@ -58,7 +58,7 @@ implements FuntestProperties, Arguments, SliderExitCodes, SliderActions {
logShell(shell)
ensureApplicationIsUp(APPLICATION_NAME)
- expectContainerCountExceeded(APPLICATION_NAME, COMMAND_LOGGER, 3)
+ expectContainerRequestedCountReached(APPLICATION_NAME, COMMAND_LOGGER, 3)
sleep(1000 * 20)
def cd = execStatus(APPLICATION_NAME)
assert cd.statistics[COMMAND_LOGGER]["containers.requested"] >= 3
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/802ff46e/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentFailuresIT.groovy
----------------------------------------------------------------------
diff --git a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentFailuresIT.groovy b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentFailuresIT.groovy
index ab6a811..a4eb1a2 100644
--- a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentFailuresIT.groovy
+++ b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentFailuresIT.groovy
@@ -58,7 +58,7 @@ implements FuntestProperties, Arguments, SliderExitCodes, SliderActions {
ensureApplicationIsUp(APPLICATION_NAME)
- expectContainerCountExceeded(APPLICATION_NAME, COMMAND_LOGGER, 2)
+ expectContainerRequestedCountReached(APPLICATION_NAME, COMMAND_LOGGER, 2)
sleep(1000 * 20)
assert isApplicationUp(APPLICATION_NAME), 'App is not running.'
def cd = expectContainersLive(APPLICATION_NAME, COMMAND_LOGGER, 1)
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/802ff46e/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AppsThroughAgentQueueAndLabelsIT.groovy
----------------------------------------------------------------------
diff --git a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AppsThroughAgentQueueAndLabelsIT.groovy b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AppsThroughAgentQueueAndLabelsIT.groovy
index f41461c..eb5baae 100644
--- a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AppsThroughAgentQueueAndLabelsIT.groovy
+++ b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AppsThroughAgentQueueAndLabelsIT.groovy
@@ -88,7 +88,7 @@ implements FuntestProperties, Arguments, SliderExitCodes, SliderActions {
ensureApplicationIsUp(APPLICATION_NAME)
- expectContainerCountExceeded(APPLICATION_NAME, COMMAND_LOGGER, 1 )
+ expectContainerRequestedCountReached(APPLICATION_NAME, COMMAND_LOGGER, 1 )
expectContainersLive(APPLICATION_NAME, COMMAND_LOGGER, 1)
//flex
@@ -102,7 +102,7 @@ implements FuntestProperties, Arguments, SliderExitCodes, SliderActions {
// sleep till the new instance starts
ensureApplicationIsUp(APPLICATION_NAME)
- expectContainerCountExceeded(APPLICATION_NAME, COMMAND_LOGGER, 3)
+ expectContainerRequestedCountReached(APPLICATION_NAME, COMMAND_LOGGER, 3)
sleep(1000 * 20)