zhuzhurk commented on a change in pull request #12375:
URL: https://github.com/apache/flink/pull/12375#discussion_r438660533



##########
File path: 
flink-runtime/src/test/java/org/apache/flink/runtime/jobmaster/slotpool/BulkSlotProviderImplTest.java
##########
@@ -0,0 +1,245 @@
+/*
+ * 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.jobmaster.slotpool;
+
+import org.apache.flink.api.common.time.Time;
+import org.apache.flink.runtime.clusterframework.types.ResourceProfile;
+import org.apache.flink.runtime.clusterframework.types.SlotProfile;
+import org.apache.flink.runtime.concurrent.ComponentMainThreadExecutor;
+import 
org.apache.flink.runtime.concurrent.ComponentMainThreadExecutorServiceAdapter;
+import org.apache.flink.runtime.jobmanager.slots.TestingSlotOwner;
+import org.apache.flink.runtime.jobmaster.SlotRequestId;
+import org.apache.flink.util.ExceptionUtils;
+import org.apache.flink.util.FlinkException;
+import org.apache.flink.util.TestLogger;
+import org.apache.flink.util.clock.ManualClock;
+
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.Optional;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+
+import static org.hamcrest.Matchers.containsInAnyOrder;
+import static org.hamcrest.Matchers.hasSize;
+import static org.hamcrest.Matchers.instanceOf;
+import static org.hamcrest.Matchers.is;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.fail;
+
+/**
+ * Tests for {@link BulkSlotProviderImpl}.
+ */
+public class BulkSlotProviderImplTest extends TestLogger {
+
+       private static final Time TIMEOUT = Time.milliseconds(1000L);
+
+       private static ScheduledExecutorService 
singleThreadScheduledExecutorService;
+
+       private static ComponentMainThreadExecutor mainThreadExecutor;
+
+       private TestingSlotPoolImpl slotPool;
+
+       private BulkSlotProviderImpl bulkSlotProvider;
+
+       private TestingSlotOwner slotOwner;
+
+       private ManualClock clock;
+
+       @BeforeClass
+       public static void setupClass() {
+               singleThreadScheduledExecutorService = 
Executors.newSingleThreadScheduledExecutor();
+               mainThreadExecutor = 
ComponentMainThreadExecutorServiceAdapter.forSingleThreadExecutor(singleThreadScheduledExecutorService);
+       }
+
+       @AfterClass
+       public static void teardownClass() {
+               if (singleThreadScheduledExecutorService != null) {
+                       singleThreadScheduledExecutorService.shutdownNow();
+               }
+       }
+
+       @Before
+       public void setup() throws Exception {
+               clock = new ManualClock();
+
+               slotPool = new SlotPoolBuilder(mainThreadExecutor).build();
+
+               bulkSlotProvider = new 
BulkSlotProviderImpl(LocationPreferenceSlotSelectionStrategy.createDefault(), 
slotPool);
+               bulkSlotProvider.start(mainThreadExecutor);
+
+               slotOwner = new TestingSlotOwner();

Review comment:
       It can be removed.
   It was for creating logical slot to occupy a physical slot, but it is not 
needed anymore since we refactored the bulk check logic into the checker class.




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


Reply via email to