asfgit closed pull request #7040: [FLINK-10750][tests] Harden
SocketClientSinkTest
URL: https://github.com/apache/flink/pull/7040
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git
a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/sink/SocketClientSinkTest.java
b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/sink/SocketClientSinkTest.java
index b3c4ee93ede..7c9863ef07f 100644
---
a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/sink/SocketClientSinkTest.java
+++
b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/sink/SocketClientSinkTest.java
@@ -24,11 +24,13 @@
import org.apache.flink.util.TestLogger;
import org.apache.commons.io.IOUtils;
+import org.junit.AssumptionViolatedException;
import org.junit.Test;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
+import java.net.BindException;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.concurrent.Callable;
@@ -279,7 +281,12 @@ public Void call() throws Exception {
retryLatch.countDown();
// Restart the server
- serverSocket[0] = new ServerSocket(port);
+ try {
+ serverSocket[0] = new ServerSocket(port);
+ } catch (BindException be) {
+ // some other process may be using this port now
+ throw new AssumptionViolatedException("Could
not bind server to previous port.", be);
+ }
Socket socket = serverSocket[0].accept();
BufferedReader reader = new BufferedReader(new
InputStreamReader(
----------------------------------------------------------------
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