Skip to content

Commit 1ff3e0f

Browse files
committed
Tweak
1 parent 4b50388 commit 1ff3e0f

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

test/framework/src/main/java/org/elasticsearch/test/ESTestCase.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -324,30 +324,31 @@ public static void bootstrapNodes(boolean condition, Runnable startAction, List<
324324
final Random bootstrapRandom = new Random(randomLong());
325325

326326
bootstrapThread = new Thread(() -> {
327-
BootstrapConfiguration bootstrapConfiguration = null;
327+
BootstrapClusterRequest bootstrapClusterRequest = null;
328328
while (stopBootstrapThread.get() == false) {
329329
final Node node = randomFrom(bootstrapRandom, nodes);
330330
final TransportService transportService = node.injector().getInstance(TransportService.class);
331331
if (transportService.getLocalNode() != null) {
332332
final Client client = clientWrapper.apply(node.client());
333-
if (bootstrapConfiguration == null) {
333+
if (bootstrapClusterRequest == null) {
334334
try {
335335
final GetDiscoveredNodesRequest discoveredNodesRequest = new GetDiscoveredNodesRequest();
336336
discoveredNodesRequest.setMinimumNodeCount(minimumConfigurationSize);
337337
if (minimumConfigurationSize > 1 && randomBoolean()) {
338338
discoveredNodesRequest.setTimeout(TimeValue.timeValueSeconds(5));
339339
}
340340

341-
bootstrapConfiguration = client.execute(GetDiscoveredNodesAction.INSTANCE, discoveredNodesRequest)
342-
.get().getBootstrapConfiguration();
341+
bootstrapClusterRequest = new BootstrapClusterRequest(
342+
client.execute(GetDiscoveredNodesAction.INSTANCE, discoveredNodesRequest).get()
343+
.getBootstrapConfiguration());
343344
} catch (Exception e) {
344345
logger.trace("exception getting bootstrap configuration", e);
345346
}
346347
} else {
347348
try {
348-
client.execute(BootstrapClusterAction.INSTANCE, new BootstrapClusterRequest(bootstrapConfiguration))
349-
.get();
349+
client.execute(BootstrapClusterAction.INSTANCE, bootstrapClusterRequest).get();
350350
if (usually(bootstrapRandom)) {
351+
// occasionally carry on trying to bootstrap even after one request succeeded.
351352
return;
352353
}
353354
} catch (Exception e) {

0 commit comments

Comments
 (0)