mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2025-02-25 18:55:28 -06:00
make logging-sensitive tests work with async logging
This commit is contained in:
parent
48055fe95f
commit
1af99a9b4f
@ -66,6 +66,9 @@ class NBErrorHandlerTest {
|
||||
NBErrorHandler eh = new NBErrorHandler(() -> "warn", () -> errorMetrics);
|
||||
ErrorDetail detail = eh.handleError(runtimeException, 1, 2);
|
||||
|
||||
logger.getContext().stop(); // force any async appenders to flush
|
||||
logger.getContext().start(); // resume processing
|
||||
|
||||
assertThat(detail.isRetryable()).isFalse();
|
||||
assertThat(appender.getFirstEntry()).contains("error with cycle");
|
||||
appender.cleanup(logger);
|
||||
@ -104,6 +107,9 @@ class NBErrorHandlerTest {
|
||||
List<Counter> histograms = errorMetrics.getExceptionCountMetrics().getCounters();
|
||||
assertThat(histograms).hasSize(1);
|
||||
|
||||
logger.getContext().stop(); // force any async appenders to flush
|
||||
logger.getContext().start(); // resume processing
|
||||
|
||||
assertThat(appender.getFirstEntry()).isNull();
|
||||
appender.cleanup(logger);
|
||||
}
|
||||
@ -120,6 +126,9 @@ class NBErrorHandlerTest {
|
||||
List<Counter> histograms = errorMetrics.getExceptionCountMetrics().getCounters();
|
||||
assertThat(histograms).hasSize(1);
|
||||
|
||||
logger.getContext().stop(); // force any async appenders to flush
|
||||
logger.getContext().start(); // resume processing
|
||||
|
||||
assertThat(appender.getFirstEntry()).contains("Starting with v4.17 onward, use 'counter'");
|
||||
appender.cleanup(logger);
|
||||
}
|
||||
@ -153,6 +162,9 @@ class NBErrorHandlerTest {
|
||||
logger.debug("NBErrorHandler is cool.");
|
||||
logger.debug("I second that.");
|
||||
|
||||
logger.getContext().stop(); // force any async appenders to flush
|
||||
logger.getContext().start(); // resume processing
|
||||
|
||||
List<String> entries = appender.getEntries();
|
||||
assertThat(entries).hasSize(2);
|
||||
assertThat(appender.getFirstEntry()).isEqualTo("NBErrorHandler is cool.");
|
||||
|
Loading…
Reference in New Issue
Block a user