tillrohrmann commented on a change in pull request #8242: [FLINK-6227][network]
Introduce the DataConsumptionException for downstream task failure
URL: https://github.com/apache/flink/pull/8242#discussion_r280482206
##########
File path:
flink-runtime/src/test/java/org/apache/flink/runtime/io/network/partition/consumer/RemoteInputChannelTest.java
##########
@@ -333,6 +331,70 @@ public void testProducerFailedException() throws
Exception {
ch.getNextBuffer();
}
+ /**
+ * Tests that {@link DataConsumptionException} is wrapped if {@link
RemoteTransportException}
+ * is thrown during creating {@link PartitionRequestClient}.
+ */
+ @Test
+ public void testDataConsumptionExceptionDuringCreatingClient() throws
Exception {
+ final ConnectionManager connManager =
mock(ConnectionManager.class);
+
when(connManager.createPartitionRequestClient(any(ConnectionID.class)))
+ .thenThrow(RemoteTransportException.class);
+
+ final ResultPartitionID partitionId = new ResultPartitionID();
+ final RemoteInputChannel ch =
createRemoteInputChannel(partitionId, connManager);
+
+ try {
+ ch.requestSubpartition(0);
+ fail("Did not throw expected DataConsumptionException");
+ } catch (IOException ex) {
+ verifyDataConsumptionException(partitionId, ex);
+ }
+ }
+
+ /**
+ * Tests that {@link DataConsumptionException} is wrapped if an
exception is thrown
+ * during requesting partition.
+ */
+ @Test
+ public void testDataConsumptionExceptionDuringPartitionRequest() throws
Exception {
+ final ConnectionManager connManager =
mock(ConnectionManager.class);
+ final PartitionRequestClient client =
mock(PartitionRequestClient.class);
+
when(connManager.createPartitionRequestClient(any(ConnectionID.class)))
+ .thenReturn(client);
+
+ final ResultPartitionID partitionId = new ResultPartitionID();
+ final RemoteInputChannel ch =
createRemoteInputChannel(partitionId, connManager);
+ when(client.requestSubpartition(partitionId, 0, ch,
0)).thenThrow(IOException.class);
Review comment:
Can we do these tests without the extensive mocking? I think this is better
for maintainability.
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services