use of org.apache.flink.util.clock.ManualClock in project flink by apache.
the class CheckpointRequestDeciderTest method decider.
private CheckpointRequestDecider decider(int maxQueued, int maxPending, int minPause, AtomicInteger currentPending, AtomicInteger currentCleaning) {
ManualClock clock = new ManualClock();
clock.advanceTime(1, TimeUnit.DAYS);
return new CheckpointRequestDecider(maxPending, NO_OP, clock, minPause, currentPending::get, currentCleaning::get, maxQueued);
}
use of org.apache.flink.util.clock.ManualClock in project flink by apache.
the class WatermarksWithIdlenessTest method testIdleWithoutEvents.
@Test
public void testIdleWithoutEvents() {
final ManualClock clock = new ManualClock(System.nanoTime());
final IdlenessTimer timer = new IdlenessTimer(clock, Duration.ofMillis(10));
// start timer
timer.checkIfIdle();
clock.advanceTime(11, MILLISECONDS);
assertTrue(timer.checkIfIdle());
}
use of org.apache.flink.util.clock.ManualClock in project flink by apache.
the class WatermarksWithIdlenessTest method testInitiallyActive.
@Test
public void testInitiallyActive() {
final ManualClock clock = new ManualClock(System.nanoTime());
final IdlenessTimer timer = new IdlenessTimer(clock, Duration.ofMillis(10));
assertFalse(timer.checkIfIdle());
}
use of org.apache.flink.util.clock.ManualClock in project flink by apache.
the class WatermarksWithIdlenessTest method testRepeatedIdleChecks.
@Test
public void testRepeatedIdleChecks() {
final ManualClock clock = new ManualClock(System.nanoTime());
final IdlenessTimer timer = createTimerAndMakeIdle(clock, Duration.ofMillis(122));
assertTrue(timer.checkIfIdle());
clock.advanceTime(100, MILLISECONDS);
assertTrue(timer.checkIfIdle());
}
use of org.apache.flink.util.clock.ManualClock in project flink by apache.
the class JobStatusMetricsTest method testCurrentTimeMetric.
@Test
void testCurrentTimeMetric() {
final ManualClock clock = new ManualClock();
final JobStatusMetrics jobStatusMetrics = new JobStatusMetrics(0L, enable(MetricOptions.JobStatusMetrics.STATE, MetricOptions.JobStatusMetrics.CURRENT_TIME, MetricOptions.JobStatusMetrics.TOTAL_TIME), clock);
final StateTimeMetric metric = jobStatusMetrics.createTimeMetric(JobStatus.RUNNING);
assertThat(metric.getCurrentTime()).isEqualTo(0L);
jobStatusMetrics.jobStatusChanges(new JobID(), JobStatus.RUNNING, 1L);
clock.advanceTime(Duration.ofMillis(11));
assertThat(metric.getCurrentTime()).isEqualTo(10L);
jobStatusMetrics.jobStatusChanges(new JobID(), JobStatus.RESTARTING, 15L);
assertThat(metric.getCurrentTime()).isEqualTo(0L);
}
Aggregations