@@ -88,77 +88,77 @@ public void testNoMasterActions() throws Exception {
88
88
internalCluster ().setDisruptionScheme (disruptionScheme );
89
89
disruptionScheme .startDisrupting ();
90
90
91
- final Client remainingClient = client ();
91
+ final Client clientToMasterlessNode = client ();
92
92
93
93
assertBusy (() -> {
94
- ClusterState state = remainingClient .admin ().cluster ().prepareState ().setLocal (true )
94
+ ClusterState state = clientToMasterlessNode .admin ().cluster ().prepareState ().setLocal (true )
95
95
.execute ().actionGet ().getState ();
96
96
assertTrue (state .blocks ().hasGlobalBlock (DiscoverySettings .NO_MASTER_BLOCK_ID ));
97
97
});
98
98
99
- assertThrows (remainingClient .prepareGet ("test" , "type1" , "1" ),
99
+ assertThrows (clientToMasterlessNode .prepareGet ("test" , "type1" , "1" ),
100
100
ClusterBlockException .class , RestStatus .SERVICE_UNAVAILABLE
101
101
);
102
102
103
- assertThrows (remainingClient .prepareGet ("no_index" , "type1" , "1" ),
103
+ assertThrows (clientToMasterlessNode .prepareGet ("no_index" , "type1" , "1" ),
104
104
ClusterBlockException .class , RestStatus .SERVICE_UNAVAILABLE
105
105
);
106
106
107
- assertThrows (remainingClient .prepareMultiGet ().add ("test" , "type1" , "1" ),
107
+ assertThrows (clientToMasterlessNode .prepareMultiGet ().add ("test" , "type1" , "1" ),
108
108
ClusterBlockException .class , RestStatus .SERVICE_UNAVAILABLE
109
109
);
110
110
111
- assertThrows (remainingClient .prepareMultiGet ().add ("no_index" , "type1" , "1" ),
111
+ assertThrows (clientToMasterlessNode .prepareMultiGet ().add ("no_index" , "type1" , "1" ),
112
112
ClusterBlockException .class , RestStatus .SERVICE_UNAVAILABLE
113
113
);
114
114
115
- assertThrows (remainingClient .admin ().indices ().prepareAnalyze ("test" , "this is a test" ),
115
+ assertThrows (clientToMasterlessNode .admin ().indices ().prepareAnalyze ("test" , "this is a test" ),
116
116
ClusterBlockException .class , RestStatus .SERVICE_UNAVAILABLE
117
117
);
118
118
119
- assertThrows (remainingClient .admin ().indices ().prepareAnalyze ("no_index" , "this is a test" ),
119
+ assertThrows (clientToMasterlessNode .admin ().indices ().prepareAnalyze ("no_index" , "this is a test" ),
120
120
ClusterBlockException .class , RestStatus .SERVICE_UNAVAILABLE
121
121
);
122
122
123
- assertThrows (remainingClient .prepareSearch ("test" ).setSize (0 ),
123
+ assertThrows (clientToMasterlessNode .prepareSearch ("test" ).setSize (0 ),
124
124
ClusterBlockException .class , RestStatus .SERVICE_UNAVAILABLE
125
125
);
126
126
127
- assertThrows (remainingClient .prepareSearch ("no_index" ).setSize (0 ),
127
+ assertThrows (clientToMasterlessNode .prepareSearch ("no_index" ).setSize (0 ),
128
128
ClusterBlockException .class , RestStatus .SERVICE_UNAVAILABLE
129
129
);
130
130
131
131
checkUpdateAction (false , timeout ,
132
- remainingClient .prepareUpdate ("test" , "type1" , "1" )
132
+ clientToMasterlessNode .prepareUpdate ("test" , "type1" , "1" )
133
133
.setScript (new Script (
134
134
ScriptType .INLINE , Script .DEFAULT_SCRIPT_LANG , "test script" ,
135
135
Collections .emptyMap ())).setTimeout (timeout ));
136
136
137
137
checkUpdateAction (true , timeout ,
138
- remainingClient .prepareUpdate ("no_index" , "type1" , "1" )
138
+ clientToMasterlessNode .prepareUpdate ("no_index" , "type1" , "1" )
139
139
.setScript (new Script (
140
140
ScriptType .INLINE , Script .DEFAULT_SCRIPT_LANG , "test script" ,
141
141
Collections .emptyMap ())).setTimeout (timeout ));
142
142
143
143
144
- checkWriteAction (remainingClient .prepareIndex ("test" , "type1" , "1" )
144
+ checkWriteAction (clientToMasterlessNode .prepareIndex ("test" , "type1" , "1" )
145
145
.setSource (XContentFactory .jsonBuilder ().startObject ().endObject ()).setTimeout (timeout ));
146
146
147
- checkWriteAction (remainingClient .prepareIndex ("no_index" , "type1" , "1" )
147
+ checkWriteAction (clientToMasterlessNode .prepareIndex ("no_index" , "type1" , "1" )
148
148
.setSource (XContentFactory .jsonBuilder ().startObject ().endObject ()).setTimeout (timeout ));
149
149
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" )
152
152
.setSource (XContentFactory .jsonBuilder ().startObject ().endObject ()));
153
- bulkRequestBuilder .add (remainingClient .prepareIndex ("test" , "type1" , "2" )
153
+ bulkRequestBuilder .add (clientToMasterlessNode .prepareIndex ("test" , "type1" , "2" )
154
154
.setSource (XContentFactory .jsonBuilder ().startObject ().endObject ()));
155
155
bulkRequestBuilder .setTimeout (timeout );
156
156
checkWriteAction (bulkRequestBuilder );
157
157
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" )
160
160
.setSource (XContentFactory .jsonBuilder ().startObject ().endObject ()));
161
- bulkRequestBuilder .add (remainingClient .prepareIndex ("no_index" , "type1" , "2" )
161
+ bulkRequestBuilder .add (clientToMasterlessNode .prepareIndex ("no_index" , "type1" , "2" )
162
162
.setSource (XContentFactory .jsonBuilder ().startObject ().endObject ()));
163
163
bulkRequestBuilder .setTimeout (timeout );
164
164
checkWriteAction (bulkRequestBuilder );
@@ -219,32 +219,32 @@ public void testNoMasterActionsWriteMasterBlock() throws Exception {
219
219
internalCluster ().setDisruptionScheme (disruptionScheme );
220
220
disruptionScheme .startDisrupting ();
221
221
222
- final Client remainingClient = client ();
222
+ final Client clientToMasterlessNode = client ();
223
223
224
224
assertTrue (awaitBusy (() -> {
225
- ClusterState state = remainingClient .admin ().cluster ().prepareState ().setLocal (true ).get ().getState ();
225
+ ClusterState state = clientToMasterlessNode .admin ().cluster ().prepareState ().setLocal (true ).get ().getState ();
226
226
return state .blocks ().hasGlobalBlock (DiscoverySettings .NO_MASTER_BLOCK_ID );
227
227
}
228
228
));
229
229
230
- GetResponse getResponse = remainingClient .prepareGet ("test1" , "type1" , "1" ).get ();
230
+ GetResponse getResponse = clientToMasterlessNode .prepareGet ("test1" , "type1" , "1" ).get ();
231
231
assertExists (getResponse );
232
232
233
- SearchResponse countResponse = remainingClient .prepareSearch ("test1" ).setAllowPartialSearchResults (true ).setSize (0 ).get ();
233
+ SearchResponse countResponse = clientToMasterlessNode .prepareSearch ("test1" ).setAllowPartialSearchResults (true ).setSize (0 ).get ();
234
234
assertHitCount (countResponse , 1L );
235
235
236
236
logger .info ("--> here 3" );
237
- SearchResponse searchResponse = remainingClient .prepareSearch ("test1" ).setAllowPartialSearchResults (true ).get ();
237
+ SearchResponse searchResponse = clientToMasterlessNode .prepareSearch ("test1" ).setAllowPartialSearchResults (true ).get ();
238
238
assertHitCount (searchResponse , 1L );
239
239
240
- countResponse = remainingClient .prepareSearch ("test2" ).setAllowPartialSearchResults (true ).setSize (0 ).get ();
240
+ countResponse = clientToMasterlessNode .prepareSearch ("test2" ).setAllowPartialSearchResults (true ).setSize (0 ).get ();
241
241
assertThat (countResponse .getTotalShards (), equalTo (3 ));
242
242
assertThat (countResponse .getSuccessfulShards (), equalTo (1 ));
243
243
244
244
TimeValue timeout = TimeValue .timeValueMillis (200 );
245
245
long now = System .currentTimeMillis ();
246
246
try {
247
- remainingClient .prepareUpdate ("test1" , "type1" , "1" )
247
+ clientToMasterlessNode .prepareUpdate ("test1" , "type1" , "1" )
248
248
.setDoc (Requests .INDEX_CONTENT_TYPE , "field" , "value2" ).setTimeout (timeout ).get ();
249
249
fail ("Expected ClusterBlockException" );
250
250
} catch (ClusterBlockException e ) {
@@ -256,7 +256,7 @@ public void testNoMasterActionsWriteMasterBlock() throws Exception {
256
256
}
257
257
258
258
try {
259
- remainingClient .prepareIndex ("test1" , "type1" , "1" )
259
+ clientToMasterlessNode .prepareIndex ("test1" , "type1" , "1" )
260
260
.setSource (XContentFactory .jsonBuilder ().startObject ().endObject ()).setTimeout (timeout ).get ();
261
261
fail ("Expected ClusterBlockException" );
262
262
} catch (ClusterBlockException e ) {
0 commit comments