Enable both timewarp on & off for ActionThrottleTests

Original commit: elastic/x-pack-elasticsearch@caa2da607f
This commit is contained in:
uboness 2015-06-06 13:04:50 +02:00
parent 096bd5b039
commit a9658cca77
3 changed files with 2 additions and 8 deletions

View File

@ -47,7 +47,7 @@ public final class SystemClock implements Clock {
@Override @Override
public TimeValue timeElapsedSince(DateTime time) { public TimeValue timeElapsedSince(DateTime time) {
return TimeValue.timeValueMillis(System.currentTimeMillis() - time.getMillis()); return TimeValue.timeValueMillis(millis() - time.getMillis());
} }
} }

View File

@ -54,11 +54,6 @@ import static org.hamcrest.Matchers.greaterThan;
*/ */
public class ActionThrottleTests extends AbstractWatcherIntegrationTests { public class ActionThrottleTests extends AbstractWatcherIntegrationTests {
@Override
protected boolean timeWarped() {
return true;
}
@Test @Slow @Repeat(iterations = 10) @Test @Slow @Repeat(iterations = 10)
public void testSingleActionAckThrottle() throws Exception { public void testSingleActionAckThrottle() throws Exception {
boolean useClientForAcking = randomBoolean(); boolean useClientForAcking = randomBoolean();

View File

@ -7,7 +7,6 @@ package org.elasticsearch.watcher.support.clock;
import org.elasticsearch.common.joda.time.DateTime; import org.elasticsearch.common.joda.time.DateTime;
import org.elasticsearch.common.joda.time.DateTimeZone; import org.elasticsearch.common.joda.time.DateTimeZone;
import org.elasticsearch.common.joda.time.Duration;
import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.unit.TimeValue;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
@ -46,7 +45,7 @@ public class ClockMock implements Clock {
@Override @Override
public TimeValue timeElapsedSince(DateTime time) { public TimeValue timeElapsedSince(DateTime time) {
return TimeValue.timeValueMillis(new Duration(time, now).getMillis()); return TimeValue.timeValueMillis(now.getMillis() - time.getMillis());
} }
public ClockMock setTime(DateTime now) { public ClockMock setTime(DateTime now) {