You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by tr...@apache.org on 2019/06/14 07:32:09 UTC

[flink] branch release-1.8 updated: [FLINK-12835][tests] Fix wrong conversion of ManualClock bug

This is an automated email from the ASF dual-hosted git repository.

trohrmann pushed a commit to branch release-1.8
in repository https://gitbox.apache.org/repos/asf/flink.git


The following commit(s) were added to refs/heads/release-1.8 by this push:
     new 685d49b  [FLINK-12835][tests] Fix wrong conversion of ManualClock bug
685d49b is described below

commit 685d49b1cf898a75722ad4c379b974ba597eb063
Author: Bo WANG <wb...@gmail.com>
AuthorDate: Thu Jun 13 20:53:20 2019 +0800

    [FLINK-12835][tests] Fix wrong conversion of ManualClock bug
    
    This closes #8733.
---
 .../org/apache/flink/runtime/jobmaster/slotpool/SlotPoolTest.java   | 6 +++---
 .../test/java/org/apache/flink/runtime/util/clock/ManualClock.java  | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/flink-runtime/src/test/java/org/apache/flink/runtime/jobmaster/slotpool/SlotPoolTest.java b/flink-runtime/src/test/java/org/apache/flink/runtime/jobmaster/slotpool/SlotPoolTest.java
index 2846bb8..d66027f 100644
--- a/flink-runtime/src/test/java/org/apache/flink/runtime/jobmaster/slotpool/SlotPoolTest.java
+++ b/flink-runtime/src/test/java/org/apache/flink/runtime/jobmaster/slotpool/SlotPoolTest.java
@@ -582,7 +582,7 @@ public class SlotPoolTest extends TestLogger {
 				slotPool.offerSlot(taskManagerLocation, taskManagerGateway, slotToExpire),
 				Matchers.is(true));
 
-			clock.advanceTime(timeout.toMilliseconds() - 1L, TimeUnit.MILLISECONDS);
+			clock.advanceTime(timeout.toMilliseconds(), TimeUnit.MILLISECONDS);
 
 			assertThat(slotPool.offerSlot(taskManagerLocation, taskManagerGateway, slotToNotExpire),
 				Matchers.is(true));
@@ -636,7 +636,7 @@ public class SlotPoolTest extends TestLogger {
 
 			assertThat(slotPool.offerSlot(taskManagerLocation, taskManagerGateway, slotToExpire), Matchers.is(true));
 
-			clock.advanceTime(timeout.toMilliseconds(), TimeUnit.MILLISECONDS);
+			clock.advanceTime(timeout.toMilliseconds() + 1, TimeUnit.MILLISECONDS);
 
 			slotPool.triggerCheckIdleSlot();
 
@@ -650,7 +650,7 @@ public class SlotPoolTest extends TestLogger {
 			scheduler.returnLogicalSlot(logicalSlot);
 
 			// advance the time so that the returned slot is now idling
-			clock.advanceTime(timeout.toMilliseconds(), TimeUnit.MILLISECONDS);
+			clock.advanceTime(timeout.toMilliseconds() + 1, TimeUnit.MILLISECONDS);
 
 			slotPool.triggerCheckIdleSlot();
 
diff --git a/flink-runtime/src/test/java/org/apache/flink/runtime/util/clock/ManualClock.java b/flink-runtime/src/test/java/org/apache/flink/runtime/util/clock/ManualClock.java
index 69ae7be..a3a15e5 100644
--- a/flink-runtime/src/test/java/org/apache/flink/runtime/util/clock/ManualClock.java
+++ b/flink-runtime/src/test/java/org/apache/flink/runtime/util/clock/ManualClock.java
@@ -30,12 +30,12 @@ public class ManualClock extends Clock {
 
 	@Override
 	public long absoluteTimeMillis() {
-		return currentTime.get() / 1_000L;
+		return currentTime.get() / 1_000_000L;
 	}
 
 	@Override
 	public long relativeTimeMillis() {
-		return currentTime.get() / 1_000L;
+		return currentTime.get() / 1_000_000L;
 	}
 
 	@Override