[TEST] Do RollingUpgrade in BWC tests

This commit is contained in:
Simon Willnauer 2014-07-10 16:12:33 +02:00
parent 62002e8192
commit e7c67bf03b
1 changed files with 14 additions and 17 deletions

View File

@ -23,14 +23,19 @@ import com.carrotsearch.randomizedtesting.generators.RandomPicks;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
import com.google.common.collect.Collections2; import com.google.common.collect.Collections2;
import org.apache.lucene.util.IOUtils; import org.apache.lucene.util.IOUtils;
import org.elasticsearch.client.*; import org.elasticsearch.client.Client;
import org.elasticsearch.client.ClusterAdminClient;
import org.elasticsearch.client.FilterClient;
import org.elasticsearch.client.IndicesAdminClient;
import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import java.io.IOException; import java.io.IOException;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import java.util.*; import java.util.Arrays;
import java.util.concurrent.ExecutionException; import java.util.Collection;
import java.util.Iterator;
import java.util.Random;
/** /**
* A test cluster implementation that holds a fixed set of external nodes as well as a InternalTestCluster * A test cluster implementation that holds a fixed set of external nodes as well as a InternalTestCluster
@ -102,7 +107,7 @@ public class CompositeTestCluster extends TestCluster {
* All nodes are shut down before the first upgrade happens. * All nodes are shut down before the first upgrade happens.
* @return <code>true</code> iff at least one node as upgraded. * @return <code>true</code> iff at least one node as upgraded.
*/ */
public synchronized boolean upgradeAllNodes() throws InterruptedException, ExecutionException { public synchronized boolean upgradeAllNodes() throws InterruptedException, IOException {
return upgradeAllNodes(ImmutableSettings.EMPTY); return upgradeAllNodes(ImmutableSettings.EMPTY);
} }
@ -113,20 +118,12 @@ public class CompositeTestCluster extends TestCluster {
* @return <code>true</code> iff at least one node as upgraded. * @return <code>true</code> iff at least one node as upgraded.
* @param nodeSettings settings for the upgrade nodes * @param nodeSettings settings for the upgrade nodes
*/ */
public synchronized boolean upgradeAllNodes(Settings nodeSettings) throws InterruptedException, ExecutionException { public synchronized boolean upgradeAllNodes(Settings nodeSettings) throws InterruptedException, IOException {
Collection<ExternalNode> runningNodes = runningNodes(); boolean upgradedOneNode = false;
final int numRunningNodes = runningNodes.size(); while(upgradeOneNode(nodeSettings)) {
for (ExternalNode node : runningNodes) { upgradedOneNode = true;
node.stop(true);
} }
if (numRunningNodes > 0) { return upgradedOneNode;
List<String> names = cluster.startNodesAsync(numRunningNodes, nodeSettings).get();
for (String nodeName : names) {
ExternalNode.waitForNode(cluster.client(), nodeName);
}
return true;
}
return false;
} }
/** /**