rjvkr2021 commented on code in PR #3844:
URL: https://github.com/apache/celeborn/pull/3844#discussion_r3971044120


##########
client/src/test/java/org/apache/celeborn/client/write/DataPushQueueSuiteJ.java:
##########
@@ -178,6 +181,103 @@ protected void pushData(PushTask task) throws IOException 
{
     client.shutdown();
   }
 
+  @Test
+  public void testDataPusherRejectsTasksWhileClosing() throws Exception {
+    CelebornConf conf = new CelebornConf();
+    DummyShuffleClient client =
+        new DummyShuffleClient(conf, new File(tempDir, 
UUID.randomUUID().toString()));
+    client.initReducePartitionMap(0, 1, 1);
+    LongAdder[] mapStatusLengths = {new LongAdder()};
+    CountDownLatch pushStarted = new CountDownLatch(1);
+    CountDownLatch allowPush = new CountDownLatch(1);
+    DataPusher dataPusher =
+        new DataPusher(0, 0, 0, 0, 1, 1, conf, client, null, integer -> {}, 
mapStatusLengths) {
+          @Override
+          protected void pushData(PushTask task) throws IOException {
+            pushStarted.countDown();
+            try {
+              allowPush.await(10, TimeUnit.SECONDS);
+            } catch (InterruptedException e) {
+              Thread.currentThread().interrupt();
+              throw new IOException(e);
+            }
+          }
+        };
+
+    dataPusher.addTask(0, new byte[1], 1);
+
+    Thread terminationThread =
+        new Thread(
+            () -> {
+              try {
+                dataPusher.waitOnTermination();
+              } catch (Exception e) {
+                throw new RuntimeException(e);
+              }
+            });

Review Comment:
   updated tests accordingly



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to