Avoid shutting down the only master (#36272)

Today the InternalTestClusterTests sometimes set up a cluster with a single
master, start some other ndoes, shut the original master down, and then reset
the cluster. This doesn't really work, because the original master may be
stale. This change avoids shutting down the only master in this situation.
This commit is contained in:
David Turner 2018-12-06 07:27:38 +00:00 committed by Yannick Welsch
parent 38d2c093ad
commit 38ab15c6fb
1 changed files with 2 additions and 1 deletions

View File

@ -300,7 +300,8 @@ public class InternalTestClusterTests extends ESTestCase {
for (String name: cluster.getNodeNames()) { for (String name: cluster.getNodeNames()) {
shardNodePaths.put(name, getNodePaths(cluster, name)); shardNodePaths.put(name, getNodePaths(cluster, name));
} }
String poorNode = randomFrom(cluster.getNodeNames()); String poorNode = randomValueOtherThanMany(n -> originalMasterCount == 1 && n.equals(cluster.getMasterName()),
() -> randomFrom(cluster.getNodeNames()));
Path dataPath = getNodePaths(cluster, poorNode)[0]; Path dataPath = getNodePaths(cluster, poorNode)[0];
final Path testMarker = dataPath.resolve("testMarker"); final Path testMarker = dataPath.resolve("testMarker");
Files.createDirectories(testMarker); Files.createDirectories(testMarker);