pnowojski commented on a change in pull request #9383: [FLINK-13248] [runtime] 
Adding processing of downstream messages in AsyncWaitOperator's wait loops
URL: https://github.com/apache/flink/pull/9383#discussion_r314335073
 
 

 ##########
 File path: 
flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/mailbox/TaskMailboxImplTest.java
 ##########
 @@ -256,11 +262,54 @@ private void testPutTake(
                        writerThread.join();
                }
 
-               mailbox.putMail(POISON_LETTER);
+               taskMailbox.putMail(POISON_LETTER);
 
                readerThread.join();
                for (int perThreadResult : results) {
                        Assert.assertEquals(numLettersPerThread, 
perThreadResult);
                }
        }
+
+       /**
+        * Tests the downstream view of {@link TaskMailbox}.
+        */
+       public static class DownstreamMailboxTest {
+               /**
+                * Object under test.
+                */
+               private TaskMailboxImpl taskMailbox;
+
+               @Before
+               public void setUp() {
+                       taskMailbox = new TaskMailboxImpl();
+                       taskMailbox.open();
+               }
+
+               @After
+               public void tearDown() {
+                       taskMailbox.close();
+               }
+
+               @Test
+               public void testPutAsHead() throws Exception {
+
+                       Runnable instanceA = () -> {};
+                       Runnable instanceB = () -> {};
+                       Runnable instanceC = () -> {};
+                       Runnable instanceD = () -> {};
+
+                       taskMailbox.getDownstreamMailbox(1).putMail(instanceC);
+                       taskMailbox.getDownstreamMailbox(2).putMail(instanceB);
+                       taskMailbox.getDownstreamMailbox(1).putMail(instanceD);
+                       taskMailbox.getDownstreamMailbox(2).putFirst(instanceA);
+
+                       Assert.assertSame(instanceA, 
taskMailbox.getDownstreamMailbox(2).takeMail());
 
 Review comment:
   maybe we should add the same test (adding mail via downstream mailboxes), 
but with consuming from the `taskMailbox` directly (not via downstream 
mailboxes as this one).

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


With regards,
Apache Git Services

Reply via email to