flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [flink] klion26 commented on a change in pull request #8484: [FLINK-12547] Add connection and socket timeouts for the blob client
Date Thu, 23 May 2019 13:18:00 GMT
klion26 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_r286929604
 
 

 ##########
 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:
   Do we need to add an assert for the error message?

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

Mime
View raw message