Skip to content

Commit

Permalink
test adjustment
Browse files Browse the repository at this point in the history
  • Loading branch information
ywelsch committed Jun 21, 2019
1 parent 1caa1b6 commit 6907d06
Showing 1 changed file with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,19 +87,18 @@ public void testVotingOnlyNodesCannotBeMasterWithoutFullMasterNodes() throws Exc
assertBusy(() -> assertThat(
client().admin().cluster().prepareState().get().getState().getLastCommittedConfiguration().getNodeIds().size(),
equalTo(3)));
final String oldMasterId = client().admin().cluster().prepareState().get().getState().nodes().getMasterNodeId();

internalCluster().stopCurrentMasterNode();

try {
assertThat(client().admin().cluster().prepareState().setMasterNodeTimeout("100ms")
.execute().actionGet().getState().nodes().getMasterNodeId(), nullValue());
fail("should not be able to find master");
} catch (MasterNotDiscoveredException e) {
// all is well, no master elected
}
expectThrows(MasterNotDiscoveredException.class, () ->
assertThat(client().admin().cluster().prepareState().setMasterNodeTimeout("100ms").execute().actionGet()
.getState().nodes().getMasterNodeId(), nullValue()));

// start a fresh full master node, which will be brought into the cluster as master by the voting-only nodes
final String newMaster = internalCluster().startNode();
assertEquals(newMaster, internalCluster().getMasterName());
final String newMasterId = client().admin().cluster().prepareState().get().getState().nodes().getMasterNodeId();
assertNotEquals(oldMasterId, newMasterId);
}
}

0 comments on commit 6907d06

Please sign in to comment.