GJL commented on a change in pull request #7632: [FLINK-11362] Port 
TaskManagerComponentsStartupShutdownTest to new co…
URL: https://github.com/apache/flink/pull/7632#discussion_r253417053
 
 

 ##########
 File path: 
flink-runtime/src/test/java/org/apache/flink/runtime/taskexecutor/TaskExecutorTest.java
 ##########
 @@ -230,6 +233,78 @@ public void teardown() throws Exception {
        @Rule
        public TestName name = new TestName();
 
+       @Test
+       public void testTaskManagerServicesShutdown() throws Exception {
+               final TaskSlotTable taskSlotTable = new 
TaskSlotTable(Collections.singleton(ResourceProfile.UNKNOWN), timerService);
+
+               final JobLeaderService jobLeaderService = new 
JobLeaderService(taskManagerLocation);
+
+               final long heartbeatInterval = 1000L;
+               final long heartbeatTimeout = 1000L;
+
+               final HeartbeatServices heartbeatServices = new 
HeartbeatServices(heartbeatInterval, heartbeatTimeout);
+
+               final IOManager ioManager = new IOManagerAsync(new String[]{ 
tmp.newFolder().getAbsolutePath() });
+
+               final TaskExecutorLocalStateStoresManager 
localStateStoresManager = new TaskExecutorLocalStateStoresManager(
+                       false,
+                       ioManager.getSpillingDirectories(),
+                       Executors.directExecutor());
+
+               final int networkBufNum = 32;
+               final int bufferSize = 32 * 1024;
+               final NetworkEnvironmentConfiguration netConf = new 
NetworkEnvironmentConfiguration(
+                       0.1f,
+                       networkBufNum * bufferSize,
+                       networkBufNum * bufferSize,
+                       bufferSize,
+                       IOManager.IOMode.SYNC,
+                       0,
+                       0,
+                       2,
+                       8,
+                       null);
+               final NetworkEnvironment networkEnvironment = new 
NetworkEnvironment(
+                       32,
+                       netConf.networkBufferSize(),
+                       netConf.partitionRequestInitialBackoff(),
+                       netConf.partitionRequestMaxBackoff(),
+                       netConf.networkBuffersPerChannel(),
+                       netConf.floatingNetworkBuffersPerGate(),
+                       true);
+               networkEnvironment.start();
+
+               final TaskManagerServices taskManagerServices = new 
TaskManagerServicesBuilder()
+                       .setTaskManagerLocation(taskManagerLocation)
+                       .setIoManager(ioManager)
+                       .setNetworkEnvironment(networkEnvironment)
+                       .setTaskSlotTable(taskSlotTable)
+                       .setJobLeaderService(jobLeaderService)
+                       .setTaskStateManager(localStateStoresManager)
+                       .build();
+
+               final TaskExecutor taskManager = new TaskExecutor(
+                       rpc,
+                       taskManagerConfiguration,
+                       haServices,
+                       taskManagerServices,
+                       heartbeatServices,
+                       
UnregisteredMetricGroups.createUnregisteredTaskManagerMetricGroup(),
+                       null,
+                       dummyBlobCacheService,
+                       testingFatalErrorHandler);
+
+               try {
+                       taskManager.start();
+               } finally {
+                       RpcUtils.terminateRpcEndpoint(taskManager, timeout);
+               }
+
+               assertThat(taskManagerServices.getMemoryManager().isShutdown(), 
is(true));
+               
assertThat(taskManagerServices.getNetworkEnvironment().isShutdown(), is(true));
 
 Review comment:
   ```suggestion
                assertThat(networkEnvironment.isShutdown(), is(true));
                assertThat(ioManager.isProperlyShutDown(), is(true));
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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