Browse Source

KAFKA-9819: Fix flaky test in StoreChangelogReaderTest (#8488)

Reviewers: A. Sophie Blee-Goldman <sophie@confluent.io>, Boyang Chen <boyang@confluent.io>, John Roesler <john@confluent.io>
pull/8507/head
Matthias J. Sax 5 years ago committed by GitHub
parent
commit
770b095e91
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      streams/src/test/java/org/apache/kafka/streams/processor/internals/StoreChangelogReaderTest.java
  2. 6
      streams/src/test/java/org/apache/kafka/streams/processor/internals/testutil/LogCaptureAppender.java

2
streams/src/test/java/org/apache/kafka/streams/processor/internals/StoreChangelogReaderTest.java

@ -946,8 +946,8 @@ public class StoreChangelogReaderTest extends EasyMockSupport { @@ -946,8 +946,8 @@ public class StoreChangelogReaderTest extends EasyMockSupport {
@Test
public void shouldNotThrowOnUnknownRevokedPartition() {
final LogCaptureAppender appender = LogCaptureAppender.createAndRegister();
LogCaptureAppender.setClassLoggerToDebug(changelogReader.getClass());
final LogCaptureAppender appender = LogCaptureAppender.createAndRegister(changelogReader.getClass());
try {
changelogReader.remove(

6
streams/src/test/java/org/apache/kafka/streams/processor/internals/testutil/LogCaptureAppender.java

@ -60,6 +60,12 @@ public class LogCaptureAppender extends AppenderSkeleton { @@ -60,6 +60,12 @@ public class LogCaptureAppender extends AppenderSkeleton {
return logCaptureAppender;
}
public static LogCaptureAppender createAndRegister(final Class<?> clazz) {
final LogCaptureAppender logCaptureAppender = new LogCaptureAppender();
Logger.getLogger(clazz).addAppender(logCaptureAppender);
return logCaptureAppender;
}
public static void setClassLoggerToDebug(final Class<?> clazz) {
Logger.getLogger(clazz).setLevel(Level.DEBUG);
}

Loading…
Cancel
Save