Skip to content

Commit 788df4a

Browse files
committed
Rename remainingClient
1 parent c793fc8 commit 788df4a

File tree

1 file changed

+28
-28
lines changed

1 file changed

+28
-28
lines changed

server/src/test/java/org/elasticsearch/cluster/NoMasterNodeIT.java

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -88,77 +88,77 @@ public void testNoMasterActions() throws Exception {
8888
internalCluster().setDisruptionScheme(disruptionScheme);
8989
disruptionScheme.startDisrupting();
9090

91-
final Client remainingClient = client();
91+
final Client clientToMasterlessNode = client();
9292

9393
assertBusy(() -> {
94-
ClusterState state = remainingClient.admin().cluster().prepareState().setLocal(true)
94+
ClusterState state = clientToMasterlessNode.admin().cluster().prepareState().setLocal(true)
9595
.execute().actionGet().getState();
9696
assertTrue(state.blocks().hasGlobalBlock(DiscoverySettings.NO_MASTER_BLOCK_ID));
9797
});
9898

99-
assertThrows(remainingClient.prepareGet("test", "type1", "1"),
99+
assertThrows(clientToMasterlessNode.prepareGet("test", "type1", "1"),
100100
ClusterBlockException.class, RestStatus.SERVICE_UNAVAILABLE
101101
);
102102

103-
assertThrows(remainingClient.prepareGet("no_index", "type1", "1"),
103+
assertThrows(clientToMasterlessNode.prepareGet("no_index", "type1", "1"),
104104
ClusterBlockException.class, RestStatus.SERVICE_UNAVAILABLE
105105
);
106106

107-
assertThrows(remainingClient.prepareMultiGet().add("test", "type1", "1"),
107+
assertThrows(clientToMasterlessNode.prepareMultiGet().add("test", "type1", "1"),
108108
ClusterBlockException.class, RestStatus.SERVICE_UNAVAILABLE
109109
);
110110

111-
assertThrows(remainingClient.prepareMultiGet().add("no_index", "type1", "1"),
111+
assertThrows(clientToMasterlessNode.prepareMultiGet().add("no_index", "type1", "1"),
112112
ClusterBlockException.class, RestStatus.SERVICE_UNAVAILABLE
113113
);
114114

115-
assertThrows(remainingClient.admin().indices().prepareAnalyze("test", "this is a test"),
115+
assertThrows(clientToMasterlessNode.admin().indices().prepareAnalyze("test", "this is a test"),
116116
ClusterBlockException.class, RestStatus.SERVICE_UNAVAILABLE
117117
);
118118

119-
assertThrows(remainingClient.admin().indices().prepareAnalyze("no_index", "this is a test"),
119+
assertThrows(clientToMasterlessNode.admin().indices().prepareAnalyze("no_index", "this is a test"),
120120
ClusterBlockException.class, RestStatus.SERVICE_UNAVAILABLE
121121
);
122122

123-
assertThrows(remainingClient.prepareSearch("test").setSize(0),
123+
assertThrows(clientToMasterlessNode.prepareSearch("test").setSize(0),
124124
ClusterBlockException.class, RestStatus.SERVICE_UNAVAILABLE
125125
);
126126

127-
assertThrows(remainingClient.prepareSearch("no_index").setSize(0),
127+
assertThrows(clientToMasterlessNode.prepareSearch("no_index").setSize(0),
128128
ClusterBlockException.class, RestStatus.SERVICE_UNAVAILABLE
129129
);
130130

131131
checkUpdateAction(false, timeout,
132-
remainingClient.prepareUpdate("test", "type1", "1")
132+
clientToMasterlessNode.prepareUpdate("test", "type1", "1")
133133
.setScript(new Script(
134134
ScriptType.INLINE, Script.DEFAULT_SCRIPT_LANG, "test script",
135135
Collections.emptyMap())).setTimeout(timeout));
136136

137137
checkUpdateAction(true, timeout,
138-
remainingClient.prepareUpdate("no_index", "type1", "1")
138+
clientToMasterlessNode.prepareUpdate("no_index", "type1", "1")
139139
.setScript(new Script(
140140
ScriptType.INLINE, Script.DEFAULT_SCRIPT_LANG, "test script",
141141
Collections.emptyMap())).setTimeout(timeout));
142142

143143

144-
checkWriteAction(remainingClient.prepareIndex("test", "type1", "1")
144+
checkWriteAction(clientToMasterlessNode.prepareIndex("test", "type1", "1")
145145
.setSource(XContentFactory.jsonBuilder().startObject().endObject()).setTimeout(timeout));
146146

147-
checkWriteAction(remainingClient.prepareIndex("no_index", "type1", "1")
147+
checkWriteAction(clientToMasterlessNode.prepareIndex("no_index", "type1", "1")
148148
.setSource(XContentFactory.jsonBuilder().startObject().endObject()).setTimeout(timeout));
149149

150-
BulkRequestBuilder bulkRequestBuilder = remainingClient.prepareBulk();
151-
bulkRequestBuilder.add(remainingClient.prepareIndex("test", "type1", "1")
150+
BulkRequestBuilder bulkRequestBuilder = clientToMasterlessNode.prepareBulk();
151+
bulkRequestBuilder.add(clientToMasterlessNode.prepareIndex("test", "type1", "1")
152152
.setSource(XContentFactory.jsonBuilder().startObject().endObject()));
153-
bulkRequestBuilder.add(remainingClient.prepareIndex("test", "type1", "2")
153+
bulkRequestBuilder.add(clientToMasterlessNode.prepareIndex("test", "type1", "2")
154154
.setSource(XContentFactory.jsonBuilder().startObject().endObject()));
155155
bulkRequestBuilder.setTimeout(timeout);
156156
checkWriteAction(bulkRequestBuilder);
157157

158-
bulkRequestBuilder = remainingClient.prepareBulk();
159-
bulkRequestBuilder.add(remainingClient.prepareIndex("no_index", "type1", "1")
158+
bulkRequestBuilder = clientToMasterlessNode.prepareBulk();
159+
bulkRequestBuilder.add(clientToMasterlessNode.prepareIndex("no_index", "type1", "1")
160160
.setSource(XContentFactory.jsonBuilder().startObject().endObject()));
161-
bulkRequestBuilder.add(remainingClient.prepareIndex("no_index", "type1", "2")
161+
bulkRequestBuilder.add(clientToMasterlessNode.prepareIndex("no_index", "type1", "2")
162162
.setSource(XContentFactory.jsonBuilder().startObject().endObject()));
163163
bulkRequestBuilder.setTimeout(timeout);
164164
checkWriteAction(bulkRequestBuilder);
@@ -219,32 +219,32 @@ public void testNoMasterActionsWriteMasterBlock() throws Exception {
219219
internalCluster().setDisruptionScheme(disruptionScheme);
220220
disruptionScheme.startDisrupting();
221221

222-
final Client remainingClient = client();
222+
final Client clientToMasterlessNode = client();
223223

224224
assertTrue(awaitBusy(() -> {
225-
ClusterState state = remainingClient.admin().cluster().prepareState().setLocal(true).get().getState();
225+
ClusterState state = clientToMasterlessNode.admin().cluster().prepareState().setLocal(true).get().getState();
226226
return state.blocks().hasGlobalBlock(DiscoverySettings.NO_MASTER_BLOCK_ID);
227227
}
228228
));
229229

230-
GetResponse getResponse = remainingClient.prepareGet("test1", "type1", "1").get();
230+
GetResponse getResponse = clientToMasterlessNode.prepareGet("test1", "type1", "1").get();
231231
assertExists(getResponse);
232232

233-
SearchResponse countResponse = remainingClient.prepareSearch("test1").setAllowPartialSearchResults(true).setSize(0).get();
233+
SearchResponse countResponse = clientToMasterlessNode.prepareSearch("test1").setAllowPartialSearchResults(true).setSize(0).get();
234234
assertHitCount(countResponse, 1L);
235235

236236
logger.info("--> here 3");
237-
SearchResponse searchResponse = remainingClient.prepareSearch("test1").setAllowPartialSearchResults(true).get();
237+
SearchResponse searchResponse = clientToMasterlessNode.prepareSearch("test1").setAllowPartialSearchResults(true).get();
238238
assertHitCount(searchResponse, 1L);
239239

240-
countResponse = remainingClient.prepareSearch("test2").setAllowPartialSearchResults(true).setSize(0).get();
240+
countResponse = clientToMasterlessNode.prepareSearch("test2").setAllowPartialSearchResults(true).setSize(0).get();
241241
assertThat(countResponse.getTotalShards(), equalTo(3));
242242
assertThat(countResponse.getSuccessfulShards(), equalTo(1));
243243

244244
TimeValue timeout = TimeValue.timeValueMillis(200);
245245
long now = System.currentTimeMillis();
246246
try {
247-
remainingClient.prepareUpdate("test1", "type1", "1")
247+
clientToMasterlessNode.prepareUpdate("test1", "type1", "1")
248248
.setDoc(Requests.INDEX_CONTENT_TYPE, "field", "value2").setTimeout(timeout).get();
249249
fail("Expected ClusterBlockException");
250250
} catch (ClusterBlockException e) {
@@ -256,7 +256,7 @@ public void testNoMasterActionsWriteMasterBlock() throws Exception {
256256
}
257257

258258
try {
259-
remainingClient.prepareIndex("test1", "type1", "1")
259+
clientToMasterlessNode.prepareIndex("test1", "type1", "1")
260260
.setSource(XContentFactory.jsonBuilder().startObject().endObject()).setTimeout(timeout).get();
261261
fail("Expected ClusterBlockException");
262262
} catch (ClusterBlockException e) {

0 commit comments

Comments
 (0)