Skip to content

Commit 5119256

Browse files
committed
Take prevElectionWon == false into account
1 parent 34567f6 commit 5119256

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

server/src/test/java/org/elasticsearch/cluster/coordination/CoordinationStateTests.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public void setupNodes() {
6767

6868
cs1 = createCoordinationState(new InMemoryPersistedState(0L, initialStateNode1), node1);
6969
cs2 = createCoordinationState(new InMemoryPersistedState(0L, initialStateNode2), node2);
70-
cs3 = createCoordinationState(new InMemoryPersistedState(0L, initialStateNode3), node2);
70+
cs3 = createCoordinationState(new InMemoryPersistedState(0L, initialStateNode3), node3);
7171
}
7272

7373
private DiscoveryNode createNode(String id) {
@@ -252,6 +252,10 @@ public void testHandleClientValue() {
252252
PublishRequest publishRequest = cs1.handleClientValue(state2);
253253
assertThat(publishRequest.getAcceptedState(), equalTo(state2));
254254
assertThat(cs1.getLastPublishedVersion(), equalTo(state2.version()));
255+
// check that another join does not mess with lastPublishedVersion
256+
Join v3 = cs3.handleStartJoin(startJoinRequest1);
257+
assertTrue(cs1.handleJoin(v3));
258+
assertThat(cs1.getLastPublishedVersion(), equalTo(state2.version()));
255259
}
256260

257261
public void testHandleClientValueWhenElectionNotWon() {

0 commit comments

Comments
 (0)