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 2020/10/23 18:29:33 UTC

[GitHub] [flink] rkhachatryan opened a new pull request #13778: [FLINK-19791][network][test] Connect to an opened port instead of 8080

rkhachatryan opened a new pull request #13778:
URL: https://github.com/apache/flink/pull/13778


   ## What is the purpose of the change
   
   A recently added `PartitionRequestClientFactoryTest.testInterruptsNotCached` fails
   if failure is detected before `NetworkClientHandler` was obtained.
   
   This PR fixes this by connecting to an opened port.
   
   ## Verifying this change
   
   This change is a test fix without any test coverage.
   
   ## Does this pull request potentially affect one of the following parts:
   
     - Dependencies (does it add or upgrade a dependency): no
     - The public API, i.e., is any changed class annotated with `@Public(Evolving)`: no
     - The serializers: no
     - The runtime per-record code paths (performance sensitive): no
     - Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn/Mesos, ZooKeeper: no
     - The S3 file system connector: no
   
   ## Documentation
   
     - Does this pull request introduce a new feature? no
     - If yes, how is the feature documented? no
   


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



[GitHub] [flink] flinkbot edited a comment on pull request #13778: [FLINK-19791][network][test] Connect to an opened port instead of 8080

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #13778:
URL: https://github.com/apache/flink/pull/13778#issuecomment-715524844


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "3881f36e07d498a9be32b0bd73c0838b8344dcb7",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=8210",
       "triggerID" : "3881f36e07d498a9be32b0bd73c0838b8344dcb7",
       "triggerType" : "PUSH"
     }, {
       "hash" : "69c2228581c8c6b288d9a6e05f43a8f3287b57f8",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=8216",
       "triggerID" : "69c2228581c8c6b288d9a6e05f43a8f3287b57f8",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 3881f36e07d498a9be32b0bd73c0838b8344dcb7 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=8210) 
   * 69c2228581c8c6b288d9a6e05f43a8f3287b57f8 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=8216) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


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



[GitHub] [flink] flinkbot edited a comment on pull request #13778: [FLINK-19791][network][test] Connect to an opened port instead of 8080

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #13778:
URL: https://github.com/apache/flink/pull/13778#issuecomment-715524844


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "3881f36e07d498a9be32b0bd73c0838b8344dcb7",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=8210",
       "triggerID" : "3881f36e07d498a9be32b0bd73c0838b8344dcb7",
       "triggerType" : "PUSH"
     }, {
       "hash" : "69c2228581c8c6b288d9a6e05f43a8f3287b57f8",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=8216",
       "triggerID" : "69c2228581c8c6b288d9a6e05f43a8f3287b57f8",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 69c2228581c8c6b288d9a6e05f43a8f3287b57f8 Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=8216) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


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



[GitHub] [flink] flinkbot commented on pull request #13778: [FLINK-19791][network][test] Connect to an opened port instead of 8080

Posted by GitBox <gi...@apache.org>.
flinkbot commented on pull request #13778:
URL: https://github.com/apache/flink/pull/13778#issuecomment-715506368


   Thanks a lot for your contribution to the Apache Flink project. I'm the @flinkbot. I help the community
   to review your pull request. We will use this comment to track the progress of the review.
   
   
   ## Automated Checks
   Last check on commit 3881f36e07d498a9be32b0bd73c0838b8344dcb7 (Fri Oct 23 18:31:51 UTC 2020)
   
   **Warnings:**
    * No documentation files were touched! Remember to keep the Flink docs up to date!
   
   
   <sub>Mention the bot in a comment to re-run the automated checks.</sub>
   ## Review Progress
   
   * ❓ 1. The [description] looks good.
   * ❓ 2. There is [consensus] that the contribution should go into to Flink.
   * ❓ 3. Needs [attention] from.
   * ❓ 4. The change fits into the overall [architecture].
   * ❓ 5. Overall code [quality] is good.
   
   Please see the [Pull Request Review Guide](https://flink.apache.org/contributing/reviewing-prs.html) for a full explanation of the review process.<details>
    The Bot is tracking the review progress through labels. Labels are applied according to the order of the review items. For consensus, approval by a Flink committer of PMC member is required <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot approve description` to approve one or more aspects (aspects: `description`, `consensus`, `architecture` and `quality`)
    - `@flinkbot approve all` to approve all aspects
    - `@flinkbot approve-until architecture` to approve everything until `architecture`
    - `@flinkbot attention @username1 [@username2 ..]` to require somebody's attention
    - `@flinkbot disapprove architecture` to remove an approval you gave earlier
   </details>


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



[GitHub] [flink] rkhachatryan commented on a change in pull request #13778: [FLINK-19791][network][test] Connect to an opened port instead of 8080

Posted by GitBox <gi...@apache.org>.
rkhachatryan commented on a change in pull request #13778:
URL: https://github.com/apache/flink/pull/13778#discussion_r511639081



##########
File path: flink-runtime/src/test/java/org/apache/flink/runtime/io/network/netty/PartitionRequestClientFactoryTest.java
##########
@@ -61,15 +61,23 @@
 
 	@Test
 	public void testInterruptsNotCached() throws Exception {
-		ConnectionID connectionId = new ConnectionID(new InetSocketAddress(InetAddress.getLocalHost(), 8080), 0);
-		try (AwaitingNettyClient nettyClient = new AwaitingNettyClient()) {
+		final NettyTestUtil.NettyServerAndClient nettyServerAndClient = createNettyServerAndClient();
+		ConnectionID connectionId = new ConnectionID(new InetSocketAddress(
+			nettyServerAndClient.server().getConfig().getServerAddress(),
+			nettyServerAndClient.server().getConfig().getServerPort()),
+			0);
+		try {
+			AwaitingNettyClient nettyClient = new AwaitingNettyClient(nettyServerAndClient.client());
 			PartitionRequestClientFactory factory = new PartitionRequestClientFactory(nettyClient, 0);
 
 			nettyClient.awaitForInterrupts = true;
 			connectAndInterrupt(factory, connectionId);
 
 			nettyClient.awaitForInterrupts = false;
 			factory.createPartitionRequestClient(connectionId);
+		} finally {
+			nettyServerAndClient.client().shutdown();
+			nettyServerAndClient.server().shutdown();
 		}

Review comment:
       The part "`client` wrapping `serverAndClient`"
   would still hold (and I'd like to avoid it).
   
   Why do you want to stick with the current way?




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



[GitHub] [flink] flinkbot edited a comment on pull request #13778: [FLINK-19791][network][test] Connect to an opened port instead of 8080

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #13778:
URL: https://github.com/apache/flink/pull/13778#issuecomment-715524844


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "3881f36e07d498a9be32b0bd73c0838b8344dcb7",
       "status" : "CANCELED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=8210",
       "triggerID" : "3881f36e07d498a9be32b0bd73c0838b8344dcb7",
       "triggerType" : "PUSH"
     }, {
       "hash" : "69c2228581c8c6b288d9a6e05f43a8f3287b57f8",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=8216",
       "triggerID" : "69c2228581c8c6b288d9a6e05f43a8f3287b57f8",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 3881f36e07d498a9be32b0bd73c0838b8344dcb7 Azure: [CANCELED](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=8210) 
   * 69c2228581c8c6b288d9a6e05f43a8f3287b57f8 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=8216) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


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



[GitHub] [flink] flinkbot commented on pull request #13778: [FLINK-19791][network][test] Connect to an opened port instead of 8080

Posted by GitBox <gi...@apache.org>.
flinkbot commented on pull request #13778:
URL: https://github.com/apache/flink/pull/13778#issuecomment-715524844


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "3881f36e07d498a9be32b0bd73c0838b8344dcb7",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "3881f36e07d498a9be32b0bd73c0838b8344dcb7",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 3881f36e07d498a9be32b0bd73c0838b8344dcb7 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


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



[GitHub] [flink] rkhachatryan commented on a change in pull request #13778: [FLINK-19791][network][test] Connect to an opened port instead of 8080

Posted by GitBox <gi...@apache.org>.
rkhachatryan commented on a change in pull request #13778:
URL: https://github.com/apache/flink/pull/13778#discussion_r511085900



##########
File path: flink-runtime/src/test/java/org/apache/flink/runtime/io/network/netty/PartitionRequestClientFactoryTest.java
##########
@@ -131,8 +129,6 @@ public void testNettyClientConnectRetryFailure() throws Exception {
 
 			factory.createPartitionRequestClient(serverAndClient.getConnectionID(0));

Review comment:
       Do you mean 
   `[tests][network][refactor] Fix IDE warnings`
   or
   `[tests][network][refactor] Extract and use NettyServerAndClient.getConnectionID`
   ?




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



[GitHub] [flink] AHeise commented on a change in pull request #13778: [FLINK-19791][network][test] Connect to an opened port instead of 8080

Posted by GitBox <gi...@apache.org>.
AHeise commented on a change in pull request #13778:
URL: https://github.com/apache/flink/pull/13778#discussion_r511748513



##########
File path: flink-runtime/src/test/java/org/apache/flink/runtime/io/network/netty/PartitionRequestClientFactoryTest.java
##########
@@ -61,15 +61,23 @@
 
 	@Test
 	public void testInterruptsNotCached() throws Exception {
-		ConnectionID connectionId = new ConnectionID(new InetSocketAddress(InetAddress.getLocalHost(), 8080), 0);
-		try (AwaitingNettyClient nettyClient = new AwaitingNettyClient()) {
+		final NettyTestUtil.NettyServerAndClient nettyServerAndClient = createNettyServerAndClient();
+		ConnectionID connectionId = new ConnectionID(new InetSocketAddress(
+			nettyServerAndClient.server().getConfig().getServerAddress(),
+			nettyServerAndClient.server().getConfig().getServerPort()),
+			0);
+		try {
+			AwaitingNettyClient nettyClient = new AwaitingNettyClient(nettyServerAndClient.client());
 			PartitionRequestClientFactory factory = new PartitionRequestClientFactory(nettyClient, 0);
 
 			nettyClient.awaitForInterrupts = true;
 			connectAndInterrupt(factory, connectionId);
 
 			nettyClient.awaitForInterrupts = false;
 			factory.createPartitionRequestClient(connectionId);
+		} finally {
+			nettyServerAndClient.client().shutdown();
+			nettyServerAndClient.server().shutdown();
 		}

Review comment:
       I like the try-with-resource approach more - it makes the code cleaner and test easier to understand. But you'd have to move the `AutoCloseable` to `NettyServerAndClient`, which is probably out of scope here. I also now fully understand your argument.




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



[GitHub] [flink] AHeise commented on a change in pull request #13778: [FLINK-19791][network][test] Connect to an opened port instead of 8080

Posted by GitBox <gi...@apache.org>.
AHeise commented on a change in pull request #13778:
URL: https://github.com/apache/flink/pull/13778#discussion_r511630751



##########
File path: flink-runtime/src/test/java/org/apache/flink/runtime/io/network/netty/PartitionRequestClientFactoryTest.java
##########
@@ -61,15 +61,23 @@
 
 	@Test
 	public void testInterruptsNotCached() throws Exception {
-		ConnectionID connectionId = new ConnectionID(new InetSocketAddress(InetAddress.getLocalHost(), 8080), 0);
-		try (AwaitingNettyClient nettyClient = new AwaitingNettyClient()) {
+		final NettyTestUtil.NettyServerAndClient nettyServerAndClient = createNettyServerAndClient();
+		ConnectionID connectionId = new ConnectionID(new InetSocketAddress(
+			nettyServerAndClient.server().getConfig().getServerAddress(),
+			nettyServerAndClient.server().getConfig().getServerPort()),
+			0);
+		try {
+			AwaitingNettyClient nettyClient = new AwaitingNettyClient(nettyServerAndClient.client());
 			PartitionRequestClientFactory factory = new PartitionRequestClientFactory(nettyClient, 0);
 
 			nettyClient.awaitForInterrupts = true;
 			connectAndInterrupt(factory, connectionId);
 
 			nettyClient.awaitForInterrupts = false;
 			factory.createPartitionRequestClient(connectionId);
+		} finally {
+			nettyServerAndClient.client().shutdown();
+			nettyServerAndClient.server().shutdown();
 		}

Review comment:
       Okay fair point. How about, keep as is, add some `AwaitingNettyClient#getSocketAddress` and use that to setup connectionId inside the try-with-resource block?




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



[GitHub] [flink] flinkbot edited a comment on pull request #13778: [FLINK-19791][network][test] Connect to an opened port instead of 8080

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #13778:
URL: https://github.com/apache/flink/pull/13778#issuecomment-715524844


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "3881f36e07d498a9be32b0bd73c0838b8344dcb7",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=8210",
       "triggerID" : "3881f36e07d498a9be32b0bd73c0838b8344dcb7",
       "triggerType" : "PUSH"
     }, {
       "hash" : "69c2228581c8c6b288d9a6e05f43a8f3287b57f8",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "69c2228581c8c6b288d9a6e05f43a8f3287b57f8",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 3881f36e07d498a9be32b0bd73c0838b8344dcb7 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=8210) 
   * 69c2228581c8c6b288d9a6e05f43a8f3287b57f8 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


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



[GitHub] [flink] AHeise merged pull request #13778: [FLINK-19791][network][test] Connect to an opened port instead of 8080

Posted by GitBox <gi...@apache.org>.
AHeise merged pull request #13778:
URL: https://github.com/apache/flink/pull/13778


   


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



[GitHub] [flink] AHeise commented on a change in pull request #13778: [FLINK-19791][network][test] Connect to an opened port instead of 8080

Posted by GitBox <gi...@apache.org>.
AHeise commented on a change in pull request #13778:
URL: https://github.com/apache/flink/pull/13778#discussion_r511081704



##########
File path: flink-runtime/src/test/java/org/apache/flink/runtime/io/network/netty/PartitionRequestClientFactoryTest.java
##########
@@ -131,8 +129,6 @@ public void testNettyClientConnectRetryFailure() throws Exception {
 
 			factory.createPartitionRequestClient(serverAndClient.getConnectionID(0));

Review comment:
       While the commit message is quite direct, it seems a bit clumsy.
   
   How about `[refactor][tests][network] Cleanup PartitionRequestClientFactoryTest`?

##########
File path: flink-runtime/src/test/java/org/apache/flink/runtime/io/network/netty/NettyTestUtil.java
##########
@@ -19,6 +19,7 @@
 package org.apache.flink.runtime.io.network.netty;
 
 import org.apache.flink.configuration.Configuration;
+import org.apache.flink.runtime.io.network.ConnectionID;
 import org.apache.flink.util.NetUtils;

Review comment:
       Add this commit before the test fix? Then you can use the method directly.

##########
File path: flink-runtime/src/test/java/org/apache/flink/runtime/io/network/netty/PartitionRequestClientFactoryTest.java
##########
@@ -61,15 +61,23 @@
 
 	@Test
 	public void testInterruptsNotCached() throws Exception {
-		ConnectionID connectionId = new ConnectionID(new InetSocketAddress(InetAddress.getLocalHost(), 8080), 0);
-		try (AwaitingNettyClient nettyClient = new AwaitingNettyClient()) {
+		final NettyTestUtil.NettyServerAndClient nettyServerAndClient = createNettyServerAndClient();
+		ConnectionID connectionId = new ConnectionID(new InetSocketAddress(
+			nettyServerAndClient.server().getConfig().getServerAddress(),
+			nettyServerAndClient.server().getConfig().getServerPort()),
+			0);
+		try {
+			AwaitingNettyClient nettyClient = new AwaitingNettyClient(nettyServerAndClient.client());
 			PartitionRequestClientFactory factory = new PartitionRequestClientFactory(nettyClient, 0);
 
 			nettyClient.awaitForInterrupts = true;
 			connectAndInterrupt(factory, connectionId);
 
 			nettyClient.awaitForInterrupts = false;
 			factory.createPartitionRequestClient(connectionId);
+		} finally {
+			nettyServerAndClient.client().shutdown();
+			nettyServerAndClient.server().shutdown();
 		}

Review comment:
       Couldn't you leave it as is and just request a `ConnectionID` from `AwaitingNettyClient`?




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



[GitHub] [flink] rkhachatryan commented on a change in pull request #13778: [FLINK-19791][network][test] Connect to an opened port instead of 8080

Posted by GitBox <gi...@apache.org>.
rkhachatryan commented on a change in pull request #13778:
URL: https://github.com/apache/flink/pull/13778#discussion_r511087179



##########
File path: flink-runtime/src/test/java/org/apache/flink/runtime/io/network/netty/PartitionRequestClientFactoryTest.java
##########
@@ -61,15 +61,23 @@
 
 	@Test
 	public void testInterruptsNotCached() throws Exception {
-		ConnectionID connectionId = new ConnectionID(new InetSocketAddress(InetAddress.getLocalHost(), 8080), 0);
-		try (AwaitingNettyClient nettyClient = new AwaitingNettyClient()) {
+		final NettyTestUtil.NettyServerAndClient nettyServerAndClient = createNettyServerAndClient();
+		ConnectionID connectionId = new ConnectionID(new InetSocketAddress(
+			nettyServerAndClient.server().getConfig().getServerAddress(),
+			nettyServerAndClient.server().getConfig().getServerPort()),
+			0);
+		try {
+			AwaitingNettyClient nettyClient = new AwaitingNettyClient(nettyServerAndClient.client());
 			PartitionRequestClientFactory factory = new PartitionRequestClientFactory(nettyClient, 0);
 
 			nettyClient.awaitForInterrupts = true;
 			connectAndInterrupt(factory, connectionId);
 
 			nettyClient.awaitForInterrupts = false;
 			factory.createPartitionRequestClient(connectionId);
+		} finally {
+			nettyServerAndClient.client().shutdown();
+			nettyServerAndClient.server().shutdown();
 		}

Review comment:
       I did it at first but it didn't look to me like a right abstraction (a `client` wrapping `serverAndClient` and exposing a `ConnectionID`).




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



[GitHub] [flink] AHeise commented on a change in pull request #13778: [FLINK-19791][network][test] Connect to an opened port instead of 8080

Posted by GitBox <gi...@apache.org>.
AHeise commented on a change in pull request #13778:
URL: https://github.com/apache/flink/pull/13778#discussion_r511630751



##########
File path: flink-runtime/src/test/java/org/apache/flink/runtime/io/network/netty/PartitionRequestClientFactoryTest.java
##########
@@ -61,15 +61,23 @@
 
 	@Test
 	public void testInterruptsNotCached() throws Exception {
-		ConnectionID connectionId = new ConnectionID(new InetSocketAddress(InetAddress.getLocalHost(), 8080), 0);
-		try (AwaitingNettyClient nettyClient = new AwaitingNettyClient()) {
+		final NettyTestUtil.NettyServerAndClient nettyServerAndClient = createNettyServerAndClient();
+		ConnectionID connectionId = new ConnectionID(new InetSocketAddress(
+			nettyServerAndClient.server().getConfig().getServerAddress(),
+			nettyServerAndClient.server().getConfig().getServerPort()),
+			0);
+		try {
+			AwaitingNettyClient nettyClient = new AwaitingNettyClient(nettyServerAndClient.client());
 			PartitionRequestClientFactory factory = new PartitionRequestClientFactory(nettyClient, 0);
 
 			nettyClient.awaitForInterrupts = true;
 			connectAndInterrupt(factory, connectionId);
 
 			nettyClient.awaitForInterrupts = false;
 			factory.createPartitionRequestClient(connectionId);
+		} finally {
+			nettyServerAndClient.client().shutdown();
+			nettyServerAndClient.server().shutdown();
 		}

Review comment:
       Okay fair point. How about, keep as is, add some `AwaitingNettyClient#getSocketAddress` and use that to setup `connectionId` inside the try-with-resource block?




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



[GitHub] [flink] rkhachatryan commented on a change in pull request #13778: [FLINK-19791][network][test] Connect to an opened port instead of 8080

Posted by GitBox <gi...@apache.org>.
rkhachatryan commented on a change in pull request #13778:
URL: https://github.com/apache/flink/pull/13778#discussion_r511085900



##########
File path: flink-runtime/src/test/java/org/apache/flink/runtime/io/network/netty/PartitionRequestClientFactoryTest.java
##########
@@ -131,8 +129,6 @@ public void testNettyClientConnectRetryFailure() throws Exception {
 
 			factory.createPartitionRequestClient(serverAndClient.getConnectionID(0));

Review comment:
       Do you mean 
   `[tests][network][refactor] Fix IDE warnings`
   or
   `[tests][network][refactor] Extract and use NettyServerAndClient.getConnectionID`
   ?




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