diff --git a/buildSrc/src/main/resources/checkstyle_suppressions.xml b/buildSrc/src/main/resources/checkstyle_suppressions.xml
index 9c776d419b207..b8f50846c0e4b 100644
--- a/buildSrc/src/main/resources/checkstyle_suppressions.xml
+++ b/buildSrc/src/main/resources/checkstyle_suppressions.xml
@@ -45,38 +45,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -185,12 +153,6 @@
-
-
-
-
-
-
diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/health/TransportClusterHealthAction.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/health/TransportClusterHealthAction.java
index 1e8d2adbff829..f105b15d6653c 100644
--- a/server/src/main/java/org/elasticsearch/action/admin/cluster/health/TransportClusterHealthAction.java
+++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/health/TransportClusterHealthAction.java
@@ -68,7 +68,8 @@ protected String executor() {
@Override
protected ClusterBlockException checkBlock(ClusterHealthRequest request, ClusterState state) {
- return null; // we want users to be able to call this even when there are global blocks, just to check the health (are there blocks?)
+ // we want users to be able to call this even when there are global blocks, just to check the health (are there blocks?)
+ return null;
}
@Override
@@ -77,64 +78,69 @@ protected ClusterHealthResponse newResponse() {
}
@Override
- protected final void masterOperation(ClusterHealthRequest request, ClusterState state, ActionListener listener) throws Exception {
+ protected final void masterOperation(ClusterHealthRequest request, ClusterState state,
+ ActionListener listener) throws Exception {
logger.warn("attempt to execute a cluster health operation without a task");
throw new UnsupportedOperationException("task parameter is required for this operation");
}
@Override
- protected void masterOperation(Task task, final ClusterHealthRequest request, final ClusterState unusedState, final ActionListener listener) {
+ protected void masterOperation(Task task, final ClusterHealthRequest request, final ClusterState unusedState,
+ final ActionListener listener) {
if (request.waitForEvents() != null) {
final long endTimeMS = TimeValue.nsecToMSec(System.nanoTime()) + request.timeout().millis();
if (request.local()) {
- clusterService.submitStateUpdateTask("cluster_health (wait_for_events [" + request.waitForEvents() + "])", new LocalClusterUpdateTask(request.waitForEvents()) {
- @Override
- public ClusterTasksResult execute(ClusterState currentState) {
- return unchanged();
- }
+ clusterService.submitStateUpdateTask("cluster_health (wait_for_events [" + request.waitForEvents() + "])",
+ new LocalClusterUpdateTask(request.waitForEvents()) {
+ @Override
+ public ClusterTasksResult execute(ClusterState currentState) {
+ return unchanged();
+ }
- @Override
- public void clusterStateProcessed(String source, ClusterState oldState, ClusterState newState) {
- final long timeoutInMillis = Math.max(0, endTimeMS - TimeValue.nsecToMSec(System.nanoTime()));
- final TimeValue newTimeout = TimeValue.timeValueMillis(timeoutInMillis);
- request.timeout(newTimeout);
- executeHealth(request, listener);
- }
+ @Override
+ public void clusterStateProcessed(String source, ClusterState oldState, ClusterState newState) {
+ final long timeoutInMillis = Math.max(0, endTimeMS - TimeValue.nsecToMSec(System.nanoTime()));
+ final TimeValue newTimeout = TimeValue.timeValueMillis(timeoutInMillis);
+ request.timeout(newTimeout);
+ executeHealth(request, listener);
+ }
- @Override
- public void onFailure(String source, Exception e) {
- logger.error(() -> new ParameterizedMessage("unexpected failure during [{}]", source), e);
- listener.onFailure(e);
- }
- });
+ @Override
+ public void onFailure(String source, Exception e) {
+ logger.error(() -> new ParameterizedMessage("unexpected failure during [{}]", source), e);
+ listener.onFailure(e);
+ }
+ });
} else {
- clusterService.submitStateUpdateTask("cluster_health (wait_for_events [" + request.waitForEvents() + "])", new ClusterStateUpdateTask(request.waitForEvents()) {
- @Override
- public ClusterState execute(ClusterState currentState) {
- return currentState;
- }
+ clusterService.submitStateUpdateTask("cluster_health (wait_for_events [" + request.waitForEvents() + "])",
+ new ClusterStateUpdateTask(request.waitForEvents()) {
+ @Override
+ public ClusterState execute(ClusterState currentState) {
+ return currentState;
+ }
- @Override
- public void clusterStateProcessed(String source, ClusterState oldState, ClusterState newState) {
- final long timeoutInMillis = Math.max(0, endTimeMS - TimeValue.nsecToMSec(System.nanoTime()));
- final TimeValue newTimeout = TimeValue.timeValueMillis(timeoutInMillis);
- request.timeout(newTimeout);
- executeHealth(request, listener);
- }
+ @Override
+ public void clusterStateProcessed(String source, ClusterState oldState, ClusterState newState) {
+ final long timeoutInMillis = Math.max(0, endTimeMS - TimeValue.nsecToMSec(System.nanoTime()));
+ final TimeValue newTimeout = TimeValue.timeValueMillis(timeoutInMillis);
+ request.timeout(newTimeout);
+ executeHealth(request, listener);
+ }
- @Override
- public void onNoLongerMaster(String source) {
- logger.trace("stopped being master while waiting for events with priority [{}]. retrying.", request.waitForEvents());
- // TransportMasterNodeAction implements the retry logic, which is triggered by passing a NotMasterException
- listener.onFailure(new NotMasterException("no longer master. source: [" + source + "]"));
- }
+ @Override
+ public void onNoLongerMaster(String source) {
+ logger.trace("stopped being master while waiting for events with priority [{}]. retrying.",
+ request.waitForEvents());
+ // TransportMasterNodeAction implements the retry logic, which is triggered by passing a NotMasterException
+ listener.onFailure(new NotMasterException("no longer master. source: [" + source + "]"));
+ }
- @Override
- public void onFailure(String source, Exception e) {
- logger.error(() -> new ParameterizedMessage("unexpected failure during [{}]", source), e);
- listener.onFailure(e);
- }
- });
+ @Override
+ public void onFailure(String source, Exception e) {
+ logger.error(() -> new ParameterizedMessage("unexpected failure during [{}]", source), e);
+ listener.onFailure(e);
+ }
+ });
}
} else {
executeHealth(request, listener);
@@ -203,7 +209,8 @@ private boolean validateRequest(final ClusterHealthRequest request, ClusterState
return readyCounter == waitFor;
}
- private ClusterHealthResponse getResponse(final ClusterHealthRequest request, ClusterState clusterState, final int waitFor, boolean timedOut) {
+ private ClusterHealthResponse getResponse(final ClusterHealthRequest request, ClusterState clusterState, final int waitFor,
+ boolean timedOut) {
ClusterHealthResponse response = clusterHealth(request, clusterState, clusterService.getMasterService().numberOfPendingTasks(),
gatewayAllocator.getNumberOfInFlightFetch(), clusterService.getMasterService().getMaxTaskWaitTime());
int readyCounter = prepareResponse(request, response, clusterState, indexNameExpressionResolver);
@@ -305,8 +312,8 @@ static int prepareResponse(final ClusterHealthRequest request, final ClusterHeal
}
- private ClusterHealthResponse clusterHealth(ClusterHealthRequest request, ClusterState clusterState, int numberOfPendingTasks, int numberOfInFlightFetch,
- TimeValue pendingTaskTimeInQueue) {
+ private ClusterHealthResponse clusterHealth(ClusterHealthRequest request, ClusterState clusterState, int numberOfPendingTasks,
+ int numberOfInFlightFetch, TimeValue pendingTaskTimeInQueue) {
if (logger.isTraceEnabled()) {
logger.trace("Calculating health based on state version [{}]", clusterState.version());
}
@@ -316,8 +323,8 @@ private ClusterHealthResponse clusterHealth(ClusterHealthRequest request, Cluste
concreteIndices = indexNameExpressionResolver.concreteIndexNames(clusterState, request);
} catch (IndexNotFoundException e) {
// one of the specified indices is not there - treat it as RED.
- ClusterHealthResponse response = new ClusterHealthResponse(clusterState.getClusterName().value(), Strings.EMPTY_ARRAY, clusterState,
- numberOfPendingTasks, numberOfInFlightFetch, UnassignedInfo.getNumberOfDelayedUnassigned(clusterState),
+ ClusterHealthResponse response = new ClusterHealthResponse(clusterState.getClusterName().value(), Strings.EMPTY_ARRAY,
+ clusterState, numberOfPendingTasks, numberOfInFlightFetch, UnassignedInfo.getNumberOfDelayedUnassigned(clusterState),
pendingTaskTimeInQueue);
response.setStatus(ClusterHealthStatus.RED);
return response;
diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/stats/ClusterStatsNodeResponse.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/stats/ClusterStatsNodeResponse.java
index 6347a027f4f89..fbee68ab3fcc3 100644
--- a/server/src/main/java/org/elasticsearch/action/admin/cluster/stats/ClusterStatsNodeResponse.java
+++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/stats/ClusterStatsNodeResponse.java
@@ -41,7 +41,8 @@ public class ClusterStatsNodeResponse extends BaseNodeResponse {
ClusterStatsNodeResponse() {
}
- public ClusterStatsNodeResponse(DiscoveryNode node, @Nullable ClusterHealthStatus clusterStatus, NodeInfo nodeInfo, NodeStats nodeStats, ShardStats[] shardsStats) {
+ public ClusterStatsNodeResponse(DiscoveryNode node, @Nullable ClusterHealthStatus clusterStatus, NodeInfo nodeInfo,
+ NodeStats nodeStats, ShardStats[] shardsStats) {
super(node);
this.nodeInfo = nodeInfo;
this.nodeStats = nodeStats;
diff --git a/server/src/test/java/org/elasticsearch/action/admin/cluster/health/ClusterHealthResponsesTests.java b/server/src/test/java/org/elasticsearch/action/admin/cluster/health/ClusterHealthResponsesTests.java
index 8c1438815250a..06a8f0fb522e8 100644
--- a/server/src/test/java/org/elasticsearch/action/admin/cluster/health/ClusterHealthResponsesTests.java
+++ b/server/src/test/java/org/elasticsearch/action/admin/cluster/health/ClusterHealthResponsesTests.java
@@ -70,7 +70,8 @@ public void testClusterHealth() throws IOException {
int inFlight = randomIntBetween(0, 200);
int delayedUnassigned = randomIntBetween(0, 200);
TimeValue pendingTaskInQueueTime = TimeValue.timeValueMillis(randomIntBetween(1000, 100000));
- ClusterHealthResponse clusterHealth = new ClusterHealthResponse("bla", new String[] {MetaData.ALL}, clusterState, pendingTasks, inFlight, delayedUnassigned, pendingTaskInQueueTime);
+ ClusterHealthResponse clusterHealth = new ClusterHealthResponse("bla", new String[] {MetaData.ALL}, clusterState, pendingTasks,
+ inFlight, delayedUnassigned, pendingTaskInQueueTime);
clusterHealth = maybeSerialize(clusterHealth);
assertClusterHealth(clusterHealth);
assertThat(clusterHealth.getNumberOfPendingTasks(), Matchers.equalTo(pendingTasks));
diff --git a/server/src/test/java/org/elasticsearch/action/admin/cluster/repositories/RepositoryBlocksIT.java b/server/src/test/java/org/elasticsearch/action/admin/cluster/repositories/RepositoryBlocksIT.java
index 43d94f56e5af3..8db74ba0a192a 100644
--- a/server/src/test/java/org/elasticsearch/action/admin/cluster/repositories/RepositoryBlocksIT.java
+++ b/server/src/test/java/org/elasticsearch/action/admin/cluster/repositories/RepositoryBlocksIT.java
@@ -66,7 +66,8 @@ public void testVerifyRepositoryWithBlocks() {
// This test checks that the Get Repository operation is never blocked, even if the cluster is read only.
try {
setClusterReadOnly(true);
- VerifyRepositoryResponse response = client().admin().cluster().prepareVerifyRepository("test-repo-blocks").execute().actionGet();
+ VerifyRepositoryResponse response = client().admin().cluster().prepareVerifyRepository("test-repo-blocks").execute()
+ .actionGet();
assertThat(response.getNodes().size(), equalTo(cluster().numDataAndMasterNodes()));
} finally {
setClusterReadOnly(false);
diff --git a/server/src/test/java/org/elasticsearch/action/admin/cluster/settings/SettingsUpdaterTests.java b/server/src/test/java/org/elasticsearch/action/admin/cluster/settings/SettingsUpdaterTests.java
index 5fcd369a8a433..c345e34d20c3a 100644
--- a/server/src/test/java/org/elasticsearch/action/admin/cluster/settings/SettingsUpdaterTests.java
+++ b/server/src/test/java/org/elasticsearch/action/admin/cluster/settings/SettingsUpdaterTests.java
@@ -57,8 +57,14 @@ public void testUpdateSetting() {
.transientSettings(Settings.builder().put(BalancedShardsAllocator.INDEX_BALANCE_FACTOR_SETTING.getKey(), 3.5)
.put(BalancedShardsAllocator.SHARD_BALANCE_FACTOR_SETTING.getKey(), 4.5).build());
ClusterState build = builder.metaData(metaData).build();
- ClusterState clusterState = updater.updateSettings(build, Settings.builder().put(BalancedShardsAllocator.INDEX_BALANCE_FACTOR_SETTING.getKey(), 0.5).build(),
- Settings.builder().put(BalancedShardsAllocator.INDEX_BALANCE_FACTOR_SETTING.getKey(), 0.4).build(), logger);
+ ClusterState clusterState = updater.updateSettings(build,
+ Settings.builder()
+ .put(BalancedShardsAllocator.INDEX_BALANCE_FACTOR_SETTING.getKey(), 0.5)
+ .build(),
+ Settings.builder()
+ .put(BalancedShardsAllocator.INDEX_BALANCE_FACTOR_SETTING.getKey(), 0.4)
+ .build(),
+ logger);
assertNotSame(clusterState, build);
assertEquals(BalancedShardsAllocator.INDEX_BALANCE_FACTOR_SETTING.get(clusterState.metaData().persistentSettings()), 0.4, 0.1);
assertEquals(BalancedShardsAllocator.SHARD_BALANCE_FACTOR_SETTING.get(clusterState.metaData().persistentSettings()), 2.5, 0.1);
@@ -73,7 +79,12 @@ public void testUpdateSetting() {
assertFalse(BalancedShardsAllocator.SHARD_BALANCE_FACTOR_SETTING.exists(clusterState.metaData().transientSettings()));
clusterState = updater.updateSettings(clusterState,
- Settings.EMPTY, Settings.builder().putNull("cluster.routing.*").put(BalancedShardsAllocator.INDEX_BALANCE_FACTOR_SETTING.getKey(), 10.0).build(), logger);
+ Settings.EMPTY,
+ Settings.builder()
+ .putNull("cluster.routing.*")
+ .put(BalancedShardsAllocator.INDEX_BALANCE_FACTOR_SETTING.getKey(), 10.0)
+ .build(),
+ logger);
assertEquals(BalancedShardsAllocator.INDEX_BALANCE_FACTOR_SETTING.get(clusterState.metaData().persistentSettings()), 10.0, 0.1);
assertFalse(BalancedShardsAllocator.SHARD_BALANCE_FACTOR_SETTING.exists(clusterState.metaData().persistentSettings()));
@@ -99,8 +110,15 @@ public void testAllOrNothing() {
ClusterState build = builder.metaData(metaData).build();
try {
- updater.updateSettings(build, Settings.builder().put(BalancedShardsAllocator.INDEX_BALANCE_FACTOR_SETTING.getKey(), "not a float").build(),
- Settings.builder().put(BalancedShardsAllocator.INDEX_BALANCE_FACTOR_SETTING.getKey(), "not a float").put(BalancedShardsAllocator.SHARD_BALANCE_FACTOR_SETTING.getKey(), 1.0f).build(), logger);
+ updater.updateSettings(build,
+ Settings.builder()
+ .put(BalancedShardsAllocator.INDEX_BALANCE_FACTOR_SETTING.getKey(), "not a float")
+ .build(),
+ Settings.builder()
+ .put(BalancedShardsAllocator.INDEX_BALANCE_FACTOR_SETTING.getKey(), "not a float")
+ .put(BalancedShardsAllocator.SHARD_BALANCE_FACTOR_SETTING.getKey(), 1.0f)
+ .build(),
+ logger);
fail("all or nothing");
} catch (IllegalArgumentException ex) {
logger.info("", ex);
@@ -119,14 +137,29 @@ public void testClusterBlock() {
settingsService.addSettingsUpdateConsumer(BalancedShardsAllocator.SHARD_BALANCE_FACTOR_SETTING, shard::set);
SettingsUpdater updater = new SettingsUpdater(settingsService);
MetaData.Builder metaData = MetaData.builder()
- .persistentSettings(Settings.builder().put(BalancedShardsAllocator.INDEX_BALANCE_FACTOR_SETTING.getKey(), 1.5)
- .put(BalancedShardsAllocator.SHARD_BALANCE_FACTOR_SETTING.getKey(), 2.5).build())
- .transientSettings(Settings.builder().put(BalancedShardsAllocator.INDEX_BALANCE_FACTOR_SETTING.getKey(), 3.5)
- .put(BalancedShardsAllocator.SHARD_BALANCE_FACTOR_SETTING.getKey(), 4.5).build());
+ .persistentSettings(
+ Settings.builder()
+ .put(BalancedShardsAllocator.INDEX_BALANCE_FACTOR_SETTING.getKey(), 1.5)
+ .put(BalancedShardsAllocator.SHARD_BALANCE_FACTOR_SETTING.getKey(), 2.5)
+ .build()
+ )
+ .transientSettings(
+ Settings.builder()
+ .put(BalancedShardsAllocator.INDEX_BALANCE_FACTOR_SETTING.getKey(), 3.5)
+ .put(BalancedShardsAllocator.SHARD_BALANCE_FACTOR_SETTING.getKey(), 4.5)
+ .build()
+ );
ClusterState build = builder.metaData(metaData).build();
- ClusterState clusterState = updater.updateSettings(build, Settings.builder().put(MetaData.SETTING_READ_ONLY_SETTING.getKey(), true).build(),
- Settings.builder().put(BalancedShardsAllocator.INDEX_BALANCE_FACTOR_SETTING.getKey(), 1.6).put(BalancedShardsAllocator.SHARD_BALANCE_FACTOR_SETTING.getKey(), 1.0f).build(), logger);
+ ClusterState clusterState = updater.updateSettings(build,
+ Settings.builder()
+ .put(MetaData.SETTING_READ_ONLY_SETTING.getKey(), true)
+ .build(),
+ Settings.builder()
+ .put(BalancedShardsAllocator.INDEX_BALANCE_FACTOR_SETTING.getKey(), 1.6)
+ .put(BalancedShardsAllocator.SHARD_BALANCE_FACTOR_SETTING.getKey(), 1.0f)
+ .build(),
+ logger);
assertEquals(clusterState.blocks().global().size(), 1);
assertEquals(clusterState.blocks().global().iterator().next(), MetaData.CLUSTER_READ_ONLY_BLOCK);
@@ -135,8 +168,15 @@ public void testClusterBlock() {
assertEquals(clusterState.blocks().global().size(), 0);
- clusterState = updater.updateSettings(build, Settings.builder().put(MetaData.SETTING_READ_ONLY_ALLOW_DELETE_SETTING.getKey(), true).build(),
- Settings.builder().put(BalancedShardsAllocator.INDEX_BALANCE_FACTOR_SETTING.getKey(), 1.6).put(BalancedShardsAllocator.SHARD_BALANCE_FACTOR_SETTING.getKey(), 1.0f).build(), logger);
+ clusterState = updater.updateSettings(build,
+ Settings.builder()
+ .put(MetaData.SETTING_READ_ONLY_ALLOW_DELETE_SETTING.getKey(), true)
+ .build(),
+ Settings.builder()
+ .put(BalancedShardsAllocator.INDEX_BALANCE_FACTOR_SETTING.getKey(), 1.6)
+ .put(BalancedShardsAllocator.SHARD_BALANCE_FACTOR_SETTING.getKey(), 1.0f)
+ .build(),
+ logger);
assertEquals(clusterState.blocks().global().size(), 1);
assertEquals(clusterState.blocks().global().iterator().next(), MetaData.CLUSTER_READ_ONLY_ALLOW_DELETE_BLOCK);
clusterState = updater.updateSettings(build, Settings.EMPTY,
diff --git a/server/src/test/java/org/elasticsearch/action/admin/cluster/snapshots/SnapshotBlocksIT.java b/server/src/test/java/org/elasticsearch/action/admin/cluster/snapshots/SnapshotBlocksIT.java
index dd875fbc4980a..4d4486434949c 100644
--- a/server/src/test/java/org/elasticsearch/action/admin/cluster/snapshots/SnapshotBlocksIT.java
+++ b/server/src/test/java/org/elasticsearch/action/admin/cluster/snapshots/SnapshotBlocksIT.java
@@ -88,7 +88,10 @@ public void testCreateSnapshotWithBlocks() {
logger.info("--> creating a snapshot is allowed when the cluster is read only");
try {
setClusterReadOnly(true);
- assertThat(client().admin().cluster().prepareCreateSnapshot(REPOSITORY_NAME, "snapshot-1").setWaitForCompletion(true).get().status(), equalTo(RestStatus.OK));
+ assertThat(
+ client().admin().cluster().prepareCreateSnapshot(REPOSITORY_NAME, "snapshot-1").setWaitForCompletion(true).get().status(),
+ equalTo(RestStatus.OK)
+ );
} finally {
setClusterReadOnly(false);
}
@@ -104,7 +107,11 @@ public void testCreateSnapshotWithIndexBlocks() {
logger.info("--> creating a snapshot is not blocked when an index is read only");
try {
enableIndexBlock(INDEX_NAME, SETTING_READ_ONLY);
- assertThat(client().admin().cluster().prepareCreateSnapshot(REPOSITORY_NAME, "snapshot-1").setIndices(COMMON_INDEX_NAME_MASK).setWaitForCompletion(true).get().status(), equalTo(RestStatus.OK));
+ assertThat(
+ client().admin().cluster().prepareCreateSnapshot(REPOSITORY_NAME, "snapshot-1")
+ .setIndices(COMMON_INDEX_NAME_MASK).setWaitForCompletion(true).get().status(),
+ equalTo(RestStatus.OK)
+ );
} finally {
disableIndexBlock(INDEX_NAME, SETTING_READ_ONLY);
}
@@ -112,9 +119,16 @@ public void testCreateSnapshotWithIndexBlocks() {
logger.info("--> creating a snapshot is blocked when an index is blocked for reads");
try {
enableIndexBlock(INDEX_NAME, SETTING_BLOCKS_READ);
- assertBlocked(client().admin().cluster().prepareCreateSnapshot(REPOSITORY_NAME, "snapshot-2").setIndices(COMMON_INDEX_NAME_MASK), IndexMetaData.INDEX_READ_BLOCK);
+ assertBlocked(
+ client().admin().cluster().prepareCreateSnapshot(REPOSITORY_NAME, "snapshot-2").setIndices(COMMON_INDEX_NAME_MASK),
+ IndexMetaData.INDEX_READ_BLOCK
+ );
logger.info("--> creating a snapshot is not blocked when an read-blocked index is not part of the snapshot");
- assertThat(client().admin().cluster().prepareCreateSnapshot(REPOSITORY_NAME, "snapshot-2").setIndices(OTHER_INDEX_NAME).setWaitForCompletion(true).get().status(), equalTo(RestStatus.OK));
+ assertThat(
+ client().admin().cluster().prepareCreateSnapshot(REPOSITORY_NAME, "snapshot-2").
+ setIndices(OTHER_INDEX_NAME).setWaitForCompletion(true).get().status(),
+ equalTo(RestStatus.OK)
+ );
} finally {
disableIndexBlock(INDEX_NAME, SETTING_BLOCKS_READ);
}
@@ -137,7 +151,10 @@ public void testRestoreSnapshotWithBlocks() {
logger.info("--> restoring a snapshot is blocked when the cluster is read only");
try {
setClusterReadOnly(true);
- assertBlocked(client().admin().cluster().prepareRestoreSnapshot(REPOSITORY_NAME, SNAPSHOT_NAME), MetaData.CLUSTER_READ_ONLY_BLOCK);
+ assertBlocked(
+ client().admin().cluster().prepareRestoreSnapshot(REPOSITORY_NAME, SNAPSHOT_NAME),
+ MetaData.CLUSTER_READ_ONLY_BLOCK
+ );
} finally {
setClusterReadOnly(false);
}
diff --git a/server/src/test/java/org/elasticsearch/action/admin/cluster/state/ClusterStateRequestTests.java b/server/src/test/java/org/elasticsearch/action/admin/cluster/state/ClusterStateRequestTests.java
index 8c77ccfef90ce..f7114a52f3db7 100644
--- a/server/src/test/java/org/elasticsearch/action/admin/cluster/state/ClusterStateRequestTests.java
+++ b/server/src/test/java/org/elasticsearch/action/admin/cluster/state/ClusterStateRequestTests.java
@@ -40,7 +40,8 @@ public void testSerialization() throws Exception {
ClusterStateRequest clusterStateRequest = new ClusterStateRequest().routingTable(randomBoolean()).metaData(randomBoolean())
.nodes(randomBoolean()).blocks(randomBoolean()).indices("testindex", "testindex2").indicesOptions(indicesOptions);
- Version testVersion = VersionUtils.randomVersionBetween(random(), Version.CURRENT.minimumCompatibilityVersion(), Version.CURRENT);
+ Version testVersion = VersionUtils.randomVersionBetween(random(), Version.CURRENT.minimumCompatibilityVersion(),
+ Version.CURRENT);
BytesStreamOutput output = new BytesStreamOutput();
output.setVersion(testVersion);
clusterStateRequest.writeTo(output);
diff --git a/server/src/test/java/org/elasticsearch/action/admin/cluster/stats/ClusterStatsIT.java b/server/src/test/java/org/elasticsearch/action/admin/cluster/stats/ClusterStatsIT.java
index 4bb6a5f3a8c41..4d6dc3bf43ba5 100644
--- a/server/src/test/java/org/elasticsearch/action/admin/cluster/stats/ClusterStatsIT.java
+++ b/server/src/test/java/org/elasticsearch/action/admin/cluster/stats/ClusterStatsIT.java
@@ -54,7 +54,8 @@ private void assertCounts(ClusterStatsNodes.Counts counts, int total, Map