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