|
70 | 70 |
|
71 | 71 | import static java.util.Collections.emptyList;
|
72 | 72 | import static java.util.Collections.emptyMap;
|
| 73 | +import static java.util.Collections.singletonList; |
73 | 74 | import static org.elasticsearch.transport.TransportService.HANDSHAKE_ACTION_NAME;
|
74 | 75 | import static org.hamcrest.Matchers.containsString;
|
75 | 76 |
|
@@ -418,12 +419,12 @@ public void testConcurrentJoining() {
|
418 | 419 | List<DiscoveryNode> nodes = IntStream.rangeClosed(1, randomIntBetween(2, 5))
|
419 | 420 | .mapToObj(nodeId -> newNode(nodeId, true)).collect(Collectors.toList());
|
420 | 421 |
|
421 |
| - VotingConfiguration votingConfiguration = new VotingConfiguration( |
422 |
| - randomSubsetOf(randomIntBetween(1, nodes.size()), nodes).stream().map(DiscoveryNode::getId).collect(Collectors.toSet())); |
| 422 | + DiscoveryNode localNode = nodes.get(0); |
| 423 | + VotingConfiguration votingConfiguration = new VotingConfiguration(randomValueOtherThan(singletonList(localNode), |
| 424 | + () -> randomSubsetOf(randomIntBetween(1, nodes.size()), nodes)).stream().map(DiscoveryNode::getId).collect(Collectors.toSet())); |
423 | 425 |
|
424 | 426 | logger.info("Voting configuration: {}", votingConfiguration);
|
425 | 427 |
|
426 |
| - DiscoveryNode localNode = nodes.get(0); |
427 | 428 | long initialTerm = randomLongBetween(1, 10);
|
428 | 429 | long initialVersion = randomLongBetween(1, 10);
|
429 | 430 | setupRealMasterServiceAndCoordinator(initialTerm, initialState(false, localNode, initialTerm, initialVersion, votingConfiguration));
|
@@ -488,12 +489,7 @@ public void testConcurrentJoining() {
|
488 | 489 | } catch (InterruptedException | BrokenBarrierException e) {
|
489 | 490 | throw new RuntimeException(e);
|
490 | 491 | }
|
491 |
| - try { |
492 |
| - joinNode(joinRequest); |
493 |
| - } catch (CoordinationStateRejectedException ignore) { |
494 |
| - // ignore: even the "correct" requests may fail as a duplicate because a concurrent election may cause a node to |
495 |
| - // spontaneously join. |
496 |
| - } |
| 492 | + joinNode(joinRequest); |
497 | 493 | }, "process " + joinRequest)).collect(Collectors.toList());
|
498 | 494 |
|
499 | 495 | assertionThread.start();
|
|
0 commit comments