zhijiangW commented on a change in pull request #7822: [FLINK-11726][network] 
Refactor the creation of ResultPartition and InputGate into NetworkEnvironment
URL: https://github.com/apache/flink/pull/7822#discussion_r278800356
 
 

 ##########
 File path: 
flink-runtime/src/test/java/org/apache/flink/runtime/taskmanager/TaskTest.java
 ##########
 @@ -251,14 +262,9 @@ public void testExecutionFailsInBlobsMissing() throws 
Exception {
 
        @Test
        public void testExecutionFailsInNetworkRegistration() throws Exception {
-               // mock a network manager that rejects registration
-               final ResultPartitionManager partitionManager = 
mock(ResultPartitionManager.class);
                final ResultPartitionConsumableNotifier consumableNotifier = 
new NoOpResultPartitionConsumableNotifier();
                final PartitionProducerStateChecker 
partitionProducerStateChecker = mock(PartitionProducerStateChecker.class);
-
-               final NetworkEnvironment network = 
mock(NetworkEnvironment.class);
-               
when(network.getResultPartitionManager()).thenReturn(partitionManager);
-               doThrow(new 
RuntimeException("buffers")).when(network).registerTask(any(Task.class));
+               final NetworkEnvironment network = new 
NetworkEnvironmentBuilder().build();
 
 Review comment:
   Only this unit test would shutdown the network atm, so I create a separate 
network for this created task in order not to affect the shared static 
`NetworkEnvironment` for other tests.
   
   I also tried to use the shared `NetworkEnvironment` here before and it seems 
not affect the other tests in practice. I guess the other tests not sensitive 
with the released `NetworkEnvironment` atm. But for safe consideration in new 
tests future I created the new network for this special test here. What do you 
think?

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

Reply via email to