Skip to content

Commit

Permalink
Removed all of the things that were explicitly killing parallel funct…
Browse files Browse the repository at this point in the history
…ional tests.
  • Loading branch information
wdschei authored and wdschei committed Jun 13, 2017
1 parent 6d17bae commit 0bce219
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 74 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,39 +126,12 @@ class ReposeContainerLauncher extends ReposeLauncher {
println()
} catch (IOException ioex) {
this.process.waitForOrKill(5000)
killIfUp()
if (throwExceptionOnKill) {
throw new TimeoutException("An error occurred while attempting to stop Repose Controller. Reason: " + ioex.getMessage())
}
}
}

private void killIfUp() {
String processes = TestUtils.getJvmProcesses()
def regex = /(\d*) ROOT.war .*/
def matcher = (processes =~ regex)
if (matcher.size() > 0) {

for (int i = 1; i <= matcher.size(); i++) {
String pid = matcher[0][i]

if (pid != null && !pid.isEmpty()) {
println("Killing running repose-valve process: " + pid)
Runtime rt = Runtime.getRuntime()
if (System.getProperty("os.name").toLowerCase().indexOf("windows") > -1)
rt.exec("taskkill " + pid.toInteger())
else
rt.exec("kill -9 " + pid.toInteger())
}
}
}
}

@Override
boolean areAnyUp() {
return TestUtils.getJvmProcesses().contains("ROOT.war")
}

@Override
void enableDebug() {
this.debugEnabled = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ abstract class ReposeLauncher {

abstract void enableDebug()

abstract boolean areAnyUp()

boolean isUp() {
this.process?.isAlive() ?: false
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,6 @@ class ReposeValveLauncher extends ReposeLauncher {
}

void start(Map params) {

boolean killOthersBeforeStarting = true
if (params.containsKey("killOthersBeforeStarting")) {
killOthersBeforeStarting = params.killOthersBeforeStarting
}
boolean waitOnJmxAfterStarting = true
if (params.containsKey("waitOnJmxAfterStarting")) {
waitOnJmxAfterStarting = params.waitOnJmxAfterStarting
Expand All @@ -92,15 +87,14 @@ class ReposeValveLauncher extends ReposeLauncher {
String clusterId = params.get('clusterId', "")
String nodeId = params.get('nodeId', "")

start(killOthersBeforeStarting, waitOnJmxAfterStarting, clusterId, nodeId)
start(waitOnJmxAfterStarting, clusterId, nodeId)
}

/**
* TODO: need to know what node in the system model we care about. There might be many, for multiple local node testing...
* @param killOthersBeforeStarting
* @param waitOnJmxAfterStarting
*/
void start(boolean killOthersBeforeStarting, boolean waitOnJmxAfterStarting, String clusterId, String nodeId) {
void start(boolean waitOnJmxAfterStarting, String clusterId, String nodeId) {

File jarFile = new File(reposeJar)
if (!jarFile.exists() || !jarFile.isFile()) {
Expand All @@ -112,13 +106,6 @@ class ReposeValveLauncher extends ReposeLauncher {
throw new FileNotFoundException("Missing or invalid configuration folder.")
}

if (killOthersBeforeStarting) {
waitForCondition(clock, '5s', '1s') {
killIfUp()
!isUp()
}
}

def debugProps = ""
def jacocoProps = ""
def classPath = ""
Expand Down Expand Up @@ -228,12 +215,9 @@ class ReposeValveLauncher extends ReposeLauncher {
println()
} catch (IOException ioex) {
this.process.waitForOrKill(5000)
killIfUp()
if (throwExceptionOnKill) {
throw new TimeoutException("An error occurred while attempting to stop Repose Controller. Reason: ${ioex.getMessage()}")
}
} finally {
configurationProvider.cleanConfigDirectory()
}
}

Expand Down Expand Up @@ -305,31 +289,4 @@ class ReposeValveLauncher extends ReposeLauncher {
def nodeIsReady = jmx.server.invoke(new ObjectName(beanName), "isNodeReady", opParams, opSignature)
return nodeIsReady
}

@Override
boolean areAnyUp() {
println TestUtils.getJvmProcesses()
return TestUtils.getJvmProcesses().contains("repose-valve.jar")
}

private static void killIfUp() {
String processes = TestUtils.getJvmProcesses()
def regex = /(\d*) repose-valve.jar .*spocktest .*/
def matcher = (processes =~ regex)
if (matcher.size() > 0) {

for (int i = 1; i <= matcher.size(); i++) {
String pid = matcher[0][i]

if (pid != null && !pid.isEmpty()) {
println("Killing running repose-valve process: " + pid)
Runtime rt = Runtime.getRuntime();
if (System.getProperty("os.name").toLowerCase().indexOf("windows") > -1)
rt.exec("taskkill " + pid.toInteger());
else
rt.exec("kill -9 " + pid.toInteger());
}
}
}
}
}

0 comments on commit 0bce219

Please sign in to comment.