|
18 | 18 | */ |
19 | 19 | package org.elasticsearch.cluster.coordination; |
20 | 20 |
|
21 | | -import org.elasticsearch.ElasticsearchException; |
22 | 21 | import org.elasticsearch.Version; |
23 | 22 | import org.elasticsearch.cluster.node.DiscoveryNode; |
24 | 23 | import org.elasticsearch.cluster.node.DiscoveryNode.Role; |
|
31 | 30 |
|
32 | 31 | import java.util.Collections; |
33 | 32 | import java.util.concurrent.atomic.AtomicBoolean; |
34 | | -import java.util.concurrent.atomic.AtomicLong; |
35 | 33 | import java.util.concurrent.atomic.AtomicReference; |
36 | 34 | import java.util.function.Supplier; |
37 | 35 | import java.util.stream.Collectors; |
@@ -217,23 +215,18 @@ public void testDoesNotBootstrapsIfZen1NodesDiscovered() { |
217 | 215 | deterministicTaskQueue.runAllTasks(); |
218 | 216 | } |
219 | 217 |
|
220 | | - public void testRetriesBootstrappingOnException() { |
221 | | - |
222 | | - final AtomicLong bootstrappingAttempts = new AtomicLong(); |
| 218 | + public void testDoesNotRetryBootstrappingOnException() { |
| 219 | + final AtomicBoolean bootstrappingAttempted = new AtomicBoolean(); |
223 | 220 | ClusterBootstrapService clusterBootstrapService = new ClusterBootstrapService(Settings.builder().putList( |
224 | 221 | INITIAL_MASTER_NODES_SETTING.getKey(), localNode.getName(), otherNode1.getName(), otherNode2.getName()).build(), |
225 | 222 | transportService, () -> Stream.of(otherNode1, otherNode2).collect(Collectors.toList()), vc -> { |
226 | | - bootstrappingAttempts.incrementAndGet(); |
227 | | - if (bootstrappingAttempts.get() < 5L) { |
228 | | - throw new ElasticsearchException("test"); |
229 | | - } |
| 223 | + assertTrue(bootstrappingAttempted.compareAndSet(false, true)); |
230 | 224 | }); |
231 | 225 |
|
232 | 226 | transportService.start(); |
233 | 227 | clusterBootstrapService.onFoundPeersUpdated(); |
234 | 228 | deterministicTaskQueue.runAllTasks(); |
235 | | - assertThat(bootstrappingAttempts.get(), greaterThanOrEqualTo(5L)); |
236 | | - assertThat(deterministicTaskQueue.getCurrentTimeMillis(), greaterThanOrEqualTo(40000L)); |
| 229 | + assertTrue(bootstrappingAttempted.get()); |
237 | 230 | } |
238 | 231 |
|
239 | 232 | public void testDoesNotBootstrapIfRequirementNotMet() { |
|
0 commit comments