turboFei commented on a change in pull request #27943: [SPARK-31179] Fast fail 
the connection while last connection failed in fast fail time window
URL: https://github.com/apache/spark/pull/27943#discussion_r402155245
 
 

 ##########
 File path: 
common/network-common/src/test/java/org/apache/spark/network/client/TransportClientFactorySuite.java
 ##########
 @@ -224,4 +226,23 @@ public void closeFactoryBeforeCreateClient() throws 
IOException, InterruptedExce
     factory.close();
     factory.createClient(TestUtils.getLocalHost(), server1.getPort());
   }
+
+  @Rule
+  public ExpectedException expectedException = ExpectedException.none();
+
+  @Test
+  public void fastFailConnectionInTimeWindow() throws IOException, 
InterruptedException {
+    TransportClientFactory factory = context.createClientFactory();
+    TransportServer server = context.createServer();
+    int unreachablePort = server.getPort();
+    server.close();
+    try {
+      factory.createClient(TestUtils.getLocalHost(), unreachablePort, true);
+    } catch (Exception e) {
+      assert(e instanceof IOException);
+    }
+    expectedException.expect(IOException.class);
+    expectedException.expectMessage("fail this connection directly");
+    factory.createClient(TestUtils.getLocalHost(), unreachablePort, true);
 
 Review comment:
   
https://github.com/junit-team/junit4/blob/435d41f0d45cfdbc1a38e1ad4eb1d5300da533f9/src/main/java/org/junit/Rule.java#L27-L30
   
   Here is the comments, it is just for each \@Test

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

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to