@@ -243,14 +243,11 @@ void shouldReEmitTriggerWhenWorkerIsDetectedAsNonResponding() throws Exception {
243
243
worker .shutdown ();
244
244
245
245
Worker newWorker = applicationContext .createBean (Worker .class , IdUtils .create (), 1 , null );
246
- applicationContext .registerSingleton (newWorker );
247
246
newWorker .run ();
247
+ assertThat (countDownLatch .await (30 , TimeUnit .SECONDS ), is (true ));
248
248
249
- boolean lastAwait = countDownLatch .await (10 , TimeUnit .SECONDS );
250
-
251
- newWorker .shutdown ();
252
249
receive .blockLast ();
253
- assertThat ( lastAwait , is ( true ) );
250
+ newWorker . shutdown ( );
254
251
}
255
252
256
253
@ Test
@@ -260,11 +257,11 @@ void shouldReEmitTriggerToTheSameWorkerGroup() throws Exception {
260
257
261
258
WorkerTrigger workerTrigger = workerTrigger (Duration .ofSeconds (5 ), "workerGroupKey" );
262
259
263
- // 2 trigger should happen because of the resubmit
260
+ // 2 triggers should happen because of the resubmit
264
261
CountDownLatch countDownLatch = new CountDownLatch (2 );
265
262
Flux <WorkerTriggerResult > receive = TestsUtils .receive (workerTriggerResultQueue , workerTriggerResult -> countDownLatch .countDown ());
266
263
267
- // we wait that the worker receive the trigger
264
+ // we wait that the worker receives the trigger
268
265
CountDownLatch triggerCountDownLatch = new CountDownLatch (1 );
269
266
Flux <Trigger > receiveTrigger = TestsUtils .receive (triggerQueue , either -> {
270
267
if (either .getLeft ().getWorkerId ().equals (worker .getId ())) {
@@ -277,14 +274,11 @@ void shouldReEmitTriggerToTheSameWorkerGroup() throws Exception {
277
274
worker .shutdown ();
278
275
279
276
Worker newWorker = applicationContext .createBean (Worker .class , IdUtils .create (), 1 , "workerGroupKey" );
280
- applicationContext .registerSingleton (newWorker );
281
277
newWorker .run ();
278
+ assertThat (countDownLatch .await (30 , TimeUnit .SECONDS ), is (true ));
282
279
283
- boolean lastAwait = countDownLatch .await (10 , TimeUnit .SECONDS );
284
-
285
- newWorker .shutdown ();
286
280
receive .blockLast ();
287
- assertThat ( lastAwait , is ( true ) );
281
+ newWorker . shutdown ( );
288
282
}
289
283
290
284
@ MockBean (WorkerGroupService .class )
0 commit comments