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_r287635709
 
 

 ##########
 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 an exception.");
+                       } catch (Throwable t) {
+                               
assertEquals(java.net.SocketTimeoutException.class, 
ExceptionUtils.stripException(t, IOException.class).getClass());
 
 Review comment:
   > We could create a new test class which contains all blob server tests 
which need to start a new blob server for each test.
   
   It's a good idea. But considering that only one test currently has this 
need, in order to reduce the maintenance cost of the code, I think we can 
create a new test class when more tests have this need in the future.

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