Skip to content

Commit

Permalink
[TEST] Use Shutdown API only if nodes are on 1.3.3 or newer to preven…
Browse files Browse the repository at this point in the history
…t shutdown problems
  • Loading branch information
s1monw committed Sep 29, 2014
1 parent aa89c48 commit cfd9ac2
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/test/java/org/elasticsearch/test/ExternalNode.java
Expand Up @@ -20,6 +20,7 @@

import com.google.common.base.Predicate;
import org.apache.lucene.util.Constants;
import org.elasticsearch.Version;
import org.elasticsearch.action.admin.cluster.node.info.NodeInfo;
import org.elasticsearch.action.admin.cluster.node.info.NodesInfoResponse;
import org.elasticsearch.client.Client;
Expand Down Expand Up @@ -215,8 +216,10 @@ synchronized void stop(boolean forceKill) {
if (running()) {
try {
if (forceKill == false && nodeInfo != null && random.nextBoolean()) {
// sometimes shut down gracefully
getClient().admin().cluster().prepareNodesShutdown(this.nodeInfo.getNode().id()).setExit(random.nextBoolean()).setDelay("0s").get();
if (nodeInfo.getVersion().onOrAfter(Version.V_1_3_3)) {
// sometimes shut down gracefully
getClient().admin().cluster().prepareNodesShutdown(this.nodeInfo.getNode().id()).setExit(random.nextBoolean()).setDelay("0s").get();
}
}
if (this.client != null) {
client.close();
Expand Down

0 comments on commit cfd9ac2

Please sign in to comment.