beam-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From boyu...@apache.org
Subject [beam] branch master updated: Revert "[BEAM-5709] Changing sleeps to CountdownLatch in test"
Date Wed, 01 May 2019 16:57:48 GMT
This is an automated email from the ASF dual-hosted git repository.

boyuanz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git


The following commit(s) were added to refs/heads/master by this push:
     new f2601b1  Revert "[BEAM-5709] Changing sleeps to CountdownLatch in test"
     new 504dd76  Merge pull request #8446 from youngoli/revert-8395-beam5709
f2601b1 is described below

commit f2601b1f246549b0c2c8ba948dafe833fbc91de1
Author: Daniel Oliveira <younghoono@gmail.com>
AuthorDate: Tue Apr 30 16:53:36 2019 -0700

    Revert "[BEAM-5709] Changing sleeps to CountdownLatch in test"
---
 .../worker/fn/BeamFnControlServiceTest.java        | 37 +++-------------------
 1 file changed, 4 insertions(+), 33 deletions(-)

diff --git a/runners/google-cloud-dataflow-java/worker/src/test/java/org/apache/beam/runners/dataflow/worker/fn/BeamFnControlServiceTest.java
b/runners/google-cloud-dataflow-java/worker/src/test/java/org/apache/beam/runners/dataflow/worker/fn/BeamFnControlServiceTest.java
index 1687720..86e2c3e 100644
--- a/runners/google-cloud-dataflow-java/worker/src/test/java/org/apache/beam/runners/dataflow/worker/fn/BeamFnControlServiceTest.java
+++ b/runners/google-cloud-dataflow-java/worker/src/test/java/org/apache/beam/runners/dataflow/worker/fn/BeamFnControlServiceTest.java
@@ -18,13 +18,11 @@
 package org.apache.beam.runners.dataflow.worker.fn;
 
 import static org.junit.Assert.assertNotNull;
-import static org.mockito.Mockito.doAnswer;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.verifyNoMoreInteractions;
 
 import java.net.InetAddress;
 import java.net.ServerSocket;
-import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 import org.apache.beam.model.fnexecution.v1.BeamFnApi;
 import org.apache.beam.model.fnexecution.v1.BeamFnControlGrpc;
@@ -67,17 +65,8 @@ public class BeamFnControlServiceTest {
     }
   }
 
-  @Test(timeout = 2000)
+  @Test
   public void testClientConnecting() throws Exception {
-    CountDownLatch requestCompleted = new CountDownLatch(1);
-    doAnswer(
-            invocation -> {
-              requestCompleted.countDown();
-              return null;
-            })
-        .when(requestObserver)
-        .onCompleted();
-
     PipelineOptions options = PipelineOptionsFactory.create();
     Endpoints.ApiServiceDescriptor descriptor = findOpenPort();
     BeamFnControlService service =
@@ -98,31 +87,14 @@ public class BeamFnControlServiceTest {
     server.shutdown();
     server.awaitTermination(1, TimeUnit.SECONDS);
     server.shutdownNow();
-
-    requestCompleted.await(); // Wait until request streams have been closed.
+    Thread.sleep(1000); // Wait for stub to close stream.
 
     verify(requestObserver).onCompleted();
     verifyNoMoreInteractions(requestObserver);
   }
 
-  @Test(timeout = 2000)
+  @Test
   public void testMultipleClientsConnecting() throws Exception {
-    CountDownLatch requestCompleted = new CountDownLatch(2);
-    doAnswer(
-            invocation -> {
-              requestCompleted.countDown();
-              return null;
-            })
-        .when(requestObserver)
-        .onCompleted();
-    doAnswer(
-            invocation -> {
-              requestCompleted.countDown();
-              return null;
-            })
-        .when(anotherRequestObserver)
-        .onCompleted();
-
     PipelineOptions options = PipelineOptionsFactory.create();
     Endpoints.ApiServiceDescriptor descriptor = findOpenPort();
     BeamFnControlService service =
@@ -154,8 +126,7 @@ public class BeamFnControlServiceTest {
     server.shutdown();
     server.awaitTermination(1, TimeUnit.SECONDS);
     server.shutdownNow();
-
-    requestCompleted.await(); // Wait until request streams have been closed.
+    Thread.sleep(1000); // Wait for stub to close stream.
 
     verify(requestObserver).onCompleted();
     verifyNoMoreInteractions(requestObserver);


Mime
View raw message