@@ -325,11 +325,16 @@ public void testClusterStateUpdateLogging() throws Exception {
325
325
MasterService .class .getCanonicalName (),
326
326
Level .DEBUG ,
327
327
"*processing [test3]: took [3s] done publishing updated cluster state (version: *, uuid: *)" ));
328
+ mockAppender .addExpectation (
329
+ new MockLogAppender .SeenEventExpectation (
330
+ "test4" ,
331
+ MasterService .class .getCanonicalName (),
332
+ Level .DEBUG ,
333
+ "*processing [test4]: took [0s] no change in cluster state" ));
328
334
329
335
Logger clusterLogger = LogManager .getLogger (MasterService .class );
330
336
Loggers .addAppender (clusterLogger , mockAppender );
331
337
try {
332
- final CountDownLatch latch = new CountDownLatch (4 );
333
338
masterService .currentTimeOverride = System .nanoTime ();
334
339
masterService .submitStateUpdateTask ("test1" , new ClusterStateUpdateTask () {
335
340
@ Override
@@ -339,9 +344,7 @@ public ClusterState execute(ClusterState currentState) throws Exception {
339
344
}
340
345
341
346
@ Override
342
- public void clusterStateProcessed (String source , ClusterState oldState , ClusterState newState ) {
343
- latch .countDown ();
344
- }
347
+ public void clusterStateProcessed (String source , ClusterState oldState , ClusterState newState ) { }
345
348
346
349
@ Override
347
350
public void onFailure (String source , Exception e ) {
@@ -361,9 +364,7 @@ public void clusterStateProcessed(String source, ClusterState oldState, ClusterS
361
364
}
362
365
363
366
@ Override
364
- public void onFailure (String source , Exception e ) {
365
- latch .countDown ();
366
- }
367
+ public void onFailure (String source , Exception e ) { }
367
368
});
368
369
masterService .submitStateUpdateTask ("test3" , new ClusterStateUpdateTask () {
369
370
@ Override
@@ -373,9 +374,7 @@ public ClusterState execute(ClusterState currentState) {
373
374
}
374
375
375
376
@ Override
376
- public void clusterStateProcessed (String source , ClusterState oldState , ClusterState newState ) {
377
- latch .countDown ();
378
- }
377
+ public void clusterStateProcessed (String source , ClusterState oldState , ClusterState newState ) { }
379
378
380
379
@ Override
381
380
public void onFailure (String source , Exception e ) {
@@ -391,21 +390,18 @@ public ClusterState execute(ClusterState currentState) {
391
390
}
392
391
393
392
@ Override
394
- public void clusterStateProcessed (String source , ClusterState oldState , ClusterState newState ) {
395
- latch .countDown ();
396
- }
393
+ public void clusterStateProcessed (String source , ClusterState oldState , ClusterState newState ) { }
397
394
398
395
@ Override
399
396
public void onFailure (String source , Exception e ) {
400
397
fail ();
401
398
}
402
399
});
403
- latch . await ( );
400
+ assertBusy ( mockAppender :: assertAllExpectationsMatched );
404
401
} finally {
405
402
Loggers .removeAppender (clusterLogger , mockAppender );
406
403
mockAppender .stop ();
407
404
}
408
- mockAppender .assertAllExpectationsMatched ();
409
405
}
410
406
411
407
public void testClusterStateBatchedUpdates () throws BrokenBarrierException , InterruptedException {
0 commit comments