mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-03-09 14:34:43 +00:00
test: change no master block assert and if it fails print which node doesn't have a master block.
Original commit: elastic/x-pack-elasticsearch@656a1bc3df
This commit is contained in:
parent
e1beb6e9b3
commit
5e7ef773b3
@ -220,17 +220,14 @@ public class NoMasterNodeTests extends AbstractWatcherIntegrationTests {
|
||||
private void stopElectedMasterNodeAndWait() throws Exception {
|
||||
internalTestCluster().stopCurrentMasterNode();
|
||||
// Can't use ensureWatcherStopped, b/c that relies on the watcher stats api which requires an elected master node
|
||||
assertThat(awaitBusy(new Predicate<Object>() {
|
||||
public boolean apply(Object obj) {
|
||||
assertBusy(new Runnable() {
|
||||
public void run () {
|
||||
for (Client client : clients()) {
|
||||
ClusterState state = client.admin().cluster().prepareState().setLocal(true).get().getState();
|
||||
if (!state.blocks().hasGlobalBlock(DiscoverySettings.NO_MASTER_BLOCK_ID)) {
|
||||
return false;
|
||||
}
|
||||
assertThat("Node [" + state.nodes().localNode() + "] should have a NO_MASTER_BLOCK", state.blocks().hasGlobalBlock(DiscoverySettings.NO_MASTER_BLOCK_ID), is(true));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}, 30, TimeUnit.SECONDS), equalTo(true));
|
||||
}, 30, TimeUnit.SECONDS);
|
||||
// Ensure that the watch manager doesn't run elsewhere
|
||||
for (WatcherService watcherService : internalTestCluster().getInstances(WatcherService.class)) {
|
||||
assertThat(watcherService.state(), is(WatcherState.STOPPED));
|
||||
|
Loading…
x
Reference in New Issue
Block a user