Github user tillrohrmann commented on a diff in the pull request:
https://github.com/apache/flink/pull/2410#discussion_r76052891
--- Diff:
flink-runtime/src/test/java/org/apache/flink/runtime/rpc/heartbeat/HeartbeatSchedulerTest.java
---
@@ -0,0 +1,248 @@
+/*
+ * 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.rpc.heartbeat;
+
+import akka.actor.ActorSystem;
+import akka.dispatch.Futures;
+import akka.util.Timeout;
+import org.apache.flink.runtime.akka.AkkaUtils;
+import org.apache.flink.runtime.rpc.RpcGateway;
+import org.apache.flink.runtime.rpc.RpcService;
+import org.apache.flink.runtime.rpc.RpcTimeout;
+import org.apache.flink.runtime.rpc.akka.AkkaRpcService;
+import org.apache.flink.util.TestLogger;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.slf4j.Logger;
+import scala.concurrent.Future;
+import scala.concurrent.duration.FiniteDuration;
+
+import java.util.UUID;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.atMost;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.timeout;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+/**
+ * test for HeartbeatScheduler, including successful case, timeout
case(retry on backoff timeout), failure case(retry)
+ */
+public class HeartbeatSchedulerTest extends TestLogger {
+ private static final long INITIAL_INTERVAL = 200;
+ private static final long INITIAL_TIMEOUT = 20;
+ private static final long MAX_TIMEOUT = 150;
+ private static final long DELAY_ON_ERROR = 100;
+ private static final long MAX_ATTEMPT_TIME = 300;
+
+
+ private static ActorSystem actorSystem;
+ private static AkkaRpcService akkaRpcService;
+
+ private static final Timeout timeout = new Timeout(10000,
TimeUnit.MILLISECONDS);
+
+ @BeforeClass
+ public static void setup() throws Exception {
+ actorSystem = AkkaUtils.createDefaultActorSystem();
+
+ akkaRpcService = new AkkaRpcService(actorSystem, timeout);
+ }
+
+ @AfterClass
+ public static void teardown() throws Exception {
+ akkaRpcService.stopService();
--- End diff --
Do we really need an `AkkaRpcService` here? Can't it be a little bit more
lightweight without starting an `ActorSystem`. Maybe you could use the
`TestingRpcService`.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---