xintongsong commented on a change in pull request #13313: URL: https://github.com/apache/flink/pull/13313#discussion_r489252654
########## File path: flink-mesos/src/test/java/org/apache/flink/mesos/runtime/clusterframework/MesosResourceManagerDriverTest.java ########## @@ -0,0 +1,361 @@ +/* + * 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.mesos.runtime.clusterframework; + +import org.apache.flink.configuration.Configuration; +import org.apache.flink.mesos.runtime.clusterframework.actors.MesosResourceManagerActorFactory; +import org.apache.flink.mesos.runtime.clusterframework.actors.MesosResourceManagerActorFactoryImpl; +import org.apache.flink.mesos.runtime.clusterframework.services.MesosServices; +import org.apache.flink.mesos.runtime.clusterframework.services.TestingMesosServices; +import org.apache.flink.mesos.runtime.clusterframework.store.MesosWorkerStore; +import org.apache.flink.mesos.runtime.clusterframework.store.TestingMesosWorkerStore; +import org.apache.flink.mesos.scheduler.ConnectionMonitor; +import org.apache.flink.mesos.scheduler.LaunchCoordinator; +import org.apache.flink.mesos.scheduler.LaunchableTask; +import org.apache.flink.mesos.scheduler.TaskMonitor; +import org.apache.flink.mesos.scheduler.TaskSchedulerBuilder; +import org.apache.flink.mesos.scheduler.TestingSchedulerDriver; +import org.apache.flink.mesos.scheduler.messages.AcceptOffers; +import org.apache.flink.mesos.util.MesosArtifactServer; +import org.apache.flink.mesos.util.MesosConfiguration; +import org.apache.flink.mesos.util.TestingMesosArtifactServer; +import org.apache.flink.runtime.akka.AkkaUtils; +import org.apache.flink.runtime.clusterframework.ContainerSpecification; +import org.apache.flink.runtime.clusterframework.ContaineredTaskManagerParameters; +import org.apache.flink.runtime.clusterframework.TaskExecutorProcessSpec; +import org.apache.flink.runtime.clusterframework.types.ResourceID; +import org.apache.flink.runtime.resourcemanager.active.ResourceManagerDriver; +import org.apache.flink.runtime.resourcemanager.active.ResourceManagerDriverTestBase; +import org.apache.flink.util.Preconditions; + +import akka.actor.ActorRef; +import akka.actor.ActorSystem; +import akka.japi.JavaPartialFunction; +import akka.testkit.TestActor; +import akka.testkit.TestProbe; +import org.apache.mesos.Protos; +import org.apache.mesos.SchedulerDriver; +import org.junit.Test; + +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.TimeUnit; + +import scala.Option; +import scala.concurrent.duration.Duration; + +import static org.hamcrest.Matchers.is; +import static org.junit.Assert.assertThat; + +/** + * Tests for {@link MesosResourceManagerDriver}. + */ +public class MesosResourceManagerDriverTest extends ResourceManagerDriverTestBase<RegisteredMesosWorkerNode> { + + private static final Duration TIMEOUT_DURATION = Duration.create(TIMEOUT_SEC, TimeUnit.SECONDS); + + private static final Protos.SlaveID SLAVE_ID = Protos.SlaveID.newBuilder().setValue("slave-id").build(); + private static final String SLAVE_HOST = "slave-host"; + + @Test + public void testAcceptOffers() throws Exception { Review comment: `MesosResourceManagerDriverTest::testAcceptOffers` is testing that when resource offer is received from Mesos, `MesosResourceManagerDriver` will properly notify `ActiveResourceManager` about that, by completing the request resource future. A `ResourceManagerDriver` works between two components: `ActiveResourceManager` and the external resource manager, thus its behaviors should be verified bidirectionally. Practically, test cases in `ResourceManagerDriverTestBase` verify that events from `ActiveResourceManager` are properly converted and forwarded to the external resource manager, while test cases in the deployment specific test class verify that events from the external resource manager are properly converted and forwarded to the `ActiveResourceManager`. ---------------------------------------------------------------- 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]
