scwhittle commented on code in PR #27308:
URL: https://github.com/apache/beam/pull/27308#discussion_r1247290976


##########
sdks/java/harness/src/test/java/org/apache/beam/fn/harness/logging/BeamFnLoggingClientTest.java:
##########
@@ -356,15 +358,28 @@ public StreamObserver<BeamFnApi.LogEntry.List> logging(
   @Test
   public void testClosableWhenBlockingForOnReady() throws Exception {
     BeamFnLoggingMDC.setInstructionId("instruction-1");
-    Collection<BeamFnApi.LogEntry> values = new ConcurrentLinkedQueue<>();
+    AtomicInteger testEntriesObserved = new AtomicInteger();
+    AtomicBoolean onReadyBlocking = new AtomicBoolean();
     AtomicReference<StreamObserver<BeamFnApi.LogControl>> 
outboundServerObserver =
         new AtomicReference<>();
+    PrintStream originalOutStream = System.out;
 
     final AtomicBoolean elementsAllowed = new AtomicBoolean(true);
     CallStreamObserver<BeamFnApi.LogEntry.List> inboundServerObserver =
         TestStreams.withOnNext(
-                (BeamFnApi.LogEntry.List logEntries) ->
-                    values.addAll(logEntries.getLogEntriesList()))
+                (BeamFnApi.LogEntry.List logEntries) -> {
+                  for (BeamFnApi.LogEntry entry : 
logEntries.getLogEntriesList()) {
+                    if 
(entry.toBuilder().clearCustomData().build().equals(TEST_ENTRY)) {
+                      int observed = testEntriesObserved.addAndGet(1);
+                      if (observed % 100 == 0) {
+                        originalOutStream.println("Saw test record " + 
observed);
+                      }
+                    } else {
+                      originalOutStream.println("Logging: " + entry);
+                    }
+                  }
+                })
+            .withOnCompleted(() -> outboundServerObserver.get().onCompleted())

Review Comment:
   missing this led to 10 second wait for soft flush in client, slowing down 
test



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