@@ -69,7 +69,13 @@ public static class WaitForPersistentTaskFuture<Params extends PersistentTaskPar
6969 public void testPersistentActionFailure () throws Exception {
7070 PersistentTasksService persistentTasksService = internalCluster ().getInstance (PersistentTasksService .class );
7171 PlainActionFuture <PersistentTask <TestParams >> future = new PlainActionFuture <>();
72- persistentTasksService .sendStartRequest (UUIDs .base64UUID (), TestPersistentTasksExecutor .NAME , new TestParams ("Blah" ), null , future );
72+ persistentTasksService .sendStartRequest (
73+ UUIDs .base64UUID (),
74+ TestPersistentTasksExecutor .NAME ,
75+ new TestParams ("Blah" ),
76+ TEST_REQUEST_TIMEOUT ,
77+ future
78+ );
7379 long allocationId = future .get ().getAllocationId ();
7480 waitForTaskToStart ();
7581 TaskInfo firstRunningTask = clusterAdmin ().prepareListTasks ()
@@ -100,7 +106,13 @@ public void testPersistentActionCompletion() throws Exception {
100106 PersistentTasksService persistentTasksService = internalCluster ().getInstance (PersistentTasksService .class );
101107 PlainActionFuture <PersistentTask <TestParams >> future = new PlainActionFuture <>();
102108 String taskId = UUIDs .base64UUID ();
103- persistentTasksService .sendStartRequest (taskId , TestPersistentTasksExecutor .NAME , new TestParams ("Blah" ), null , future );
109+ persistentTasksService .sendStartRequest (
110+ taskId ,
111+ TestPersistentTasksExecutor .NAME ,
112+ new TestParams ("Blah" ),
113+ TEST_REQUEST_TIMEOUT ,
114+ future
115+ );
104116 long allocationId = future .get ().getAllocationId ();
105117 waitForTaskToStart ();
106118 TaskInfo firstRunningTask = clusterAdmin ().prepareListTasks ()
@@ -119,7 +131,14 @@ public void testPersistentActionCompletion() throws Exception {
119131 logger .info ("Simulating errant completion notification" );
120132 // try sending completion request with incorrect allocation id
121133 PlainActionFuture <PersistentTask <?>> failedCompletionNotificationFuture = new PlainActionFuture <>();
122- persistentTasksService .sendCompletionRequest (taskId , Long .MAX_VALUE , null , null , null , failedCompletionNotificationFuture );
134+ persistentTasksService .sendCompletionRequest (
135+ taskId ,
136+ Long .MAX_VALUE ,
137+ null ,
138+ null ,
139+ TEST_REQUEST_TIMEOUT ,
140+ failedCompletionNotificationFuture
141+ );
123142 assertFutureThrows (failedCompletionNotificationFuture , ResourceNotFoundException .class );
124143 // Make sure that the task is still running
125144 assertThat (
@@ -141,7 +160,13 @@ public void testPersistentActionWithNoAvailableNode() throws Exception {
141160 PlainActionFuture <PersistentTask <TestParams >> future = new PlainActionFuture <>();
142161 TestParams testParams = new TestParams ("Blah" );
143162 testParams .setExecutorNodeAttr ("test" );
144- persistentTasksService .sendStartRequest (UUIDs .base64UUID (), TestPersistentTasksExecutor .NAME , testParams , null , future );
163+ persistentTasksService .sendStartRequest (
164+ UUIDs .base64UUID (),
165+ TestPersistentTasksExecutor .NAME ,
166+ testParams ,
167+ TEST_REQUEST_TIMEOUT ,
168+ future
169+ );
145170 String taskId = future .get ().getId ();
146171
147172 Settings nodeSettings = Settings .builder ().put (nodeSettings (0 , Settings .EMPTY )).put ("node.attr.test_attr" , "test" ).build ();
@@ -165,7 +190,7 @@ public void testPersistentActionWithNoAvailableNode() throws Exception {
165190
166191 // Remove the persistent task
167192 PlainActionFuture <PersistentTask <?>> removeFuture = new PlainActionFuture <>();
168- persistentTasksService .sendRemoveRequest (taskId , null , removeFuture );
193+ persistentTasksService .sendRemoveRequest (taskId , TEST_REQUEST_TIMEOUT , removeFuture );
169194 assertEquals (removeFuture .get ().getId (), taskId );
170195 }
171196
@@ -182,7 +207,13 @@ public void testPersistentActionWithNonClusterStateCondition() throws Exception
182207 PersistentTasksService persistentTasksService = internalCluster ().getInstance (PersistentTasksService .class );
183208 PlainActionFuture <PersistentTask <TestParams >> future = new PlainActionFuture <>();
184209 TestParams testParams = new TestParams ("Blah" );
185- persistentTasksService .sendStartRequest (UUIDs .base64UUID (), TestPersistentTasksExecutor .NAME , testParams , null , future );
210+ persistentTasksService .sendStartRequest (
211+ UUIDs .base64UUID (),
212+ TestPersistentTasksExecutor .NAME ,
213+ testParams ,
214+ TEST_REQUEST_TIMEOUT ,
215+ future
216+ );
186217 String taskId = future .get ().getId ();
187218
188219 assertThat (clusterAdmin ().prepareListTasks ().setActions (TestPersistentTasksExecutor .NAME + "[c]" ).get ().getTasks (), empty ());
@@ -197,14 +228,20 @@ public void testPersistentActionWithNonClusterStateCondition() throws Exception
197228
198229 // Remove the persistent task
199230 PlainActionFuture <PersistentTask <?>> removeFuture = new PlainActionFuture <>();
200- persistentTasksService .sendRemoveRequest (taskId , null , removeFuture );
231+ persistentTasksService .sendRemoveRequest (taskId , TEST_REQUEST_TIMEOUT , removeFuture );
201232 assertEquals (removeFuture .get ().getId (), taskId );
202233 }
203234
204235 public void testPersistentActionStatusUpdate () throws Exception {
205236 PersistentTasksService persistentTasksService = internalCluster ().getInstance (PersistentTasksService .class );
206237 PlainActionFuture <PersistentTask <TestParams >> future = new PlainActionFuture <>();
207- persistentTasksService .sendStartRequest (UUIDs .base64UUID (), TestPersistentTasksExecutor .NAME , new TestParams ("Blah" ), null , future );
238+ persistentTasksService .sendStartRequest (
239+ UUIDs .base64UUID (),
240+ TestPersistentTasksExecutor .NAME ,
241+ new TestParams ("Blah" ),
242+ TEST_REQUEST_TIMEOUT ,
243+ future
244+ );
208245 String taskId = future .get ().getId ();
209246 waitForTaskToStart ();
210247 TaskInfo firstRunningTask = clusterAdmin ().prepareListTasks ()
@@ -250,7 +287,7 @@ public void testPersistentActionStatusUpdate() throws Exception {
250287 assertFutureThrows (future1 , IllegalStateException .class , "timed out after 10ms" );
251288
252289 PlainActionFuture <PersistentTask <?>> failedUpdateFuture = new PlainActionFuture <>();
253- persistentTasksService .sendUpdateStateRequest (taskId , -2 , new State ("should fail" ), null , failedUpdateFuture );
290+ persistentTasksService .sendUpdateStateRequest (taskId , -2 , new State ("should fail" ), TEST_REQUEST_TIMEOUT , failedUpdateFuture );
254291 assertFutureThrows (
255292 failedUpdateFuture ,
256293 ResourceNotFoundException .class ,
@@ -275,11 +312,23 @@ public void testCreatePersistentTaskWithDuplicateId() throws Exception {
275312 PersistentTasksService persistentTasksService = internalCluster ().getInstance (PersistentTasksService .class );
276313 PlainActionFuture <PersistentTask <TestParams >> future = new PlainActionFuture <>();
277314 String taskId = UUIDs .base64UUID ();
278- persistentTasksService .sendStartRequest (taskId , TestPersistentTasksExecutor .NAME , new TestParams ("Blah" ), null , future );
315+ persistentTasksService .sendStartRequest (
316+ taskId ,
317+ TestPersistentTasksExecutor .NAME ,
318+ new TestParams ("Blah" ),
319+ TEST_REQUEST_TIMEOUT ,
320+ future
321+ );
279322 future .get ();
280323
281324 PlainActionFuture <PersistentTask <TestParams >> future2 = new PlainActionFuture <>();
282- persistentTasksService .sendStartRequest (taskId , TestPersistentTasksExecutor .NAME , new TestParams ("Blah" ), null , future2 );
325+ persistentTasksService .sendStartRequest (
326+ taskId ,
327+ TestPersistentTasksExecutor .NAME ,
328+ new TestParams ("Blah" ),
329+ TEST_REQUEST_TIMEOUT ,
330+ future2
331+ );
283332 assertFutureThrows (future2 , ResourceAlreadyExistsException .class );
284333
285334 waitForTaskToStart ();
@@ -315,7 +364,13 @@ public void testUnassignRunningPersistentTask() throws Exception {
315364 PlainActionFuture <PersistentTask <TestParams >> future = new PlainActionFuture <>();
316365 TestParams testParams = new TestParams ("Blah" );
317366 testParams .setExecutorNodeAttr ("test" );
318- persistentTasksService .sendStartRequest (UUIDs .base64UUID (), TestPersistentTasksExecutor .NAME , testParams , null , future );
367+ persistentTasksService .sendStartRequest (
368+ UUIDs .base64UUID (),
369+ TestPersistentTasksExecutor .NAME ,
370+ testParams ,
371+ TEST_REQUEST_TIMEOUT ,
372+ future
373+ );
319374 PersistentTask <TestParams > task = future .get ();
320375 String taskId = task .getId ();
321376
@@ -366,7 +421,13 @@ public void testAbortLocally() throws Exception {
366421 persistentTasksClusterService .setRecheckInterval (TimeValue .timeValueMillis (1 ));
367422 PersistentTasksService persistentTasksService = internalCluster ().getInstance (PersistentTasksService .class );
368423 PlainActionFuture <PersistentTask <TestParams >> future = new PlainActionFuture <>();
369- persistentTasksService .sendStartRequest (UUIDs .base64UUID (), TestPersistentTasksExecutor .NAME , new TestParams ("Blah" ), null , future );
424+ persistentTasksService .sendStartRequest (
425+ UUIDs .base64UUID (),
426+ TestPersistentTasksExecutor .NAME ,
427+ new TestParams ("Blah" ),
428+ TEST_REQUEST_TIMEOUT ,
429+ future
430+ );
370431 String taskId = future .get ().getId ();
371432 long allocationId = future .get ().getAllocationId ();
372433 waitForTaskToStart ();
0 commit comments