dlg99 commented on issue #1696: MdcContextTest fails on 
testAddFailsWithReadOnlyBookie
URL: https://github.com/apache/bookkeeper/issues/1696#issuecomment-424088925
 
 
   @eolivelli stack points to the mock / List used in the mock.
   @sijie I cannot repro this locally, ran the test suite in the loop for a 
long time.
   
   my guess the following patch should help but I cannot repro the failure even 
without it.
   Can you give it a try?
   
   ```
   diff --git 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/client/MdcContextTest.java
 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/client/MdcContextTest.java
   index f10427b8b..535b97a4b 100644
   --- 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/client/MdcContextTest.java
   +++ 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/client/MdcContextTest.java
   @@ -32,8 +32,8 @@ import static org.mockito.Mockito.mock;
    import static org.mockito.Mockito.when;
   
    import java.io.File;
   -import java.util.LinkedList;
   -import java.util.List;
   +import java.util.Queue;
   +import java.util.concurrent.ConcurrentLinkedQueue;
   
    import lombok.extern.slf4j.Slf4j;
   
   @@ -69,7 +69,7 @@ public class MdcContextTest extends 
BookKeeperClusterTestCase {
        LedgerHandle lh;
   
        private Appender mockAppender;
   -    private List<String> capturedEvents;
   +    private Queue<String> capturedEvents;
        private Logger rootLogger = LogManager.getRootLogger();
   
        public MdcContextTest() {
   @@ -122,7 +122,7 @@ public class MdcContextTest extends 
BookKeeperClusterTestCase {
   
            rootLogger.addAppender(mockAppender);
            rootLogger.setLevel(Level.INFO);
   -        capturedEvents = new LinkedList<>();
   +        capturedEvents = new ConcurrentLinkedQueue<>();
   
            doAnswer(answerVoid((LoggingEvent event) -> capturedEvents.add(
                        mdcFormat(event.getMDC(MDC_REQUEST_ID), 
event.getRenderedMessage())
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to