zentol commented on a change in pull request #7780: [FLINK-11593][tests] Check 
& port TaskManagerTest to new code base
URL: https://github.com/apache/flink/pull/7780#discussion_r269536143
 
 

 ##########
 File path: 
flink-runtime/src/test/java/org/apache/flink/runtime/taskexecutor/TaskExecutorTestBase.java
 ##########
 @@ -0,0 +1,151 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.runtime.taskexecutor;
+
+import org.apache.flink.api.common.JobID;
+import org.apache.flink.api.common.time.Time;
+import org.apache.flink.configuration.Configuration;
+import org.apache.flink.runtime.blob.BlobCacheService;
+import org.apache.flink.runtime.blob.VoidBlobStore;
+import org.apache.flink.runtime.clusterframework.types.AllocationID;
+import org.apache.flink.runtime.concurrent.Executors;
+import org.apache.flink.runtime.heartbeat.HeartbeatServices;
+import 
org.apache.flink.runtime.highavailability.TestingHighAvailabilityServices;
+import org.apache.flink.runtime.leaderretrieval.SettableLeaderRetrievalService;
+import org.apache.flink.runtime.rpc.RpcUtils;
+import org.apache.flink.runtime.rpc.TestingRpcService;
+import org.apache.flink.runtime.state.TaskExecutorLocalStateStoresManager;
+import org.apache.flink.runtime.taskexecutor.slot.TimerService;
+import org.apache.flink.runtime.taskmanager.LocalTaskManagerLocation;
+import org.apache.flink.runtime.taskmanager.TaskManagerLocation;
+import org.apache.flink.runtime.testingUtils.TestingUtils;
+import org.apache.flink.runtime.util.TestingFatalErrorHandler;
+import org.apache.flink.util.TestLogger;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.rules.TemporaryFolder;
+import org.junit.rules.TestName;
+
+import java.io.File;
+import java.io.IOException;
+
+/**
+ * Utility base class for testing Task Executor.
+ */
+public abstract class TaskExecutorTestBase extends TestLogger {
+
+       public static final HeartbeatServices HEARTBEAT_SERVICES = new 
HeartbeatServices(1000L, 1000L);
+       @Rule
+       public final TemporaryFolder tmp = new TemporaryFolder();
+
+       @Rule
+       public final TestName testName = new TestName();
+
+       protected static final Time timeout = Time.milliseconds(10000L);
+
+       protected TestingRpcService rpc;
+
+       protected BlobCacheService dummyBlobCacheService;
+
+       protected TimerService<AllocationID> timerService;
+
+       protected Configuration configuration;
+
+       protected TaskManagerConfiguration taskManagerConfiguration;
 
 Review comment:
   This field is primarily used in the TaskExecutorTest, and imo belongs in 
there. The same applies to `configuration`.
   
   This highlights a larger design issue of this class; it is used in 2 
entirely different ways (1 test accessing fields and being able to mutate them, 
the other having them passed to the builder having to overwrite them)
   
   I'm not convinced that it makes sense to satisfy both needs with a single 
class.
   
   I suggest to move everything but the environment things back into 
`TaskExecutorTest`, duplicate the defaults into the 
`TaskSubmissionTestEnvironment` and remove 
`prepareTaskSubmissionTestEnvironmentBuilder`.

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