You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2019/05/24 02:34:52 UTC

[GitHub] [flink] sunhaibotb commented on a change in pull request #8484: [FLINK-12547] Add connection and socket timeouts for the blob client

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_r287197202
 
 

 ##########
 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());
 
 Review comment:
   I think asserting the exception type is sufficient.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services