sunhaibotb commented on a change in pull request #8484: [FLINK-12547] Add 
connection and socket timeouts for the blob client
URL: https://github.com/apache/flink/pull/8484#discussion_r287197990
 
 

 ##########
 File path: 
flink-runtime/src/test/java/org/apache/flink/runtime/blob/BlobClientTest.java
 ##########
 @@ -487,4 +488,58 @@ private static void uploadJarFile(
                        validateGetAndClose(blobClient.getInternal(jobId, 
blobKeys.get(0)), testFile);
                }
        }
+
+
+       /**
+        * Tests the socket operation timeout.
+        */
+       @Test
+       public void testSocketTimeout() {
+               Configuration clientConfig = getBlobClientConfig();
+               int oldSoTimeout = 
clientConfig.getInteger(BlobServerOptions.SO_TIMEOUT);
+
+               clientConfig.setInteger(BlobServerOptions.SO_TIMEOUT, 50);
+               getBlobServer().setBlockingMillis(10_000);
+
+               try {
+                       InetSocketAddress serverAddress = new 
InetSocketAddress("localhost", getBlobServer().getPort());
+
+                       try (BlobClient client = new BlobClient(serverAddress, 
clientConfig)) {
+                               client.getInternal(new JobID(), 
BlobKey.createKey(TRANSIENT_BLOB));
+
+                               fail("Should throw a exception.");
+                       } catch (Throwable t) {
+                               
assertEquals(java.net.SocketTimeoutException.class, 
ExceptionUtils.stripException(t, IOException.class).getClass());
+                       }
+               } finally {
+                       clientConfig.setInteger(BlobServerOptions.SO_TIMEOUT, 
oldSoTimeout);
 
 Review comment:
   In that case, the blob server need to be started every time, which will 
lengthen the test time. 

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