Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FLINK-23419][streaming] Fixed the condition in testNextFirstCheckpointBarrierOvertakesCancellationBarrier in order to make the test more stable #16534

Merged
merged 1 commit into from
Jul 21, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
import static org.hamcrest.Matchers.greaterThan;
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.lessThan;
import static org.hamcrest.Matchers.lessThanOrEqualTo;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
Expand Down Expand Up @@ -357,13 +356,28 @@ public void testNextFirstCheckpointBarrierOvertakesCancellationBarrier() throws
ValidatingCheckpointHandler validator = new ValidatingCheckpointHandler();
inputGate = createCheckpointedInputGate(2, sequence, validator);

for (BufferOrEvent boe : sequence) {
assertEquals(boe, inputGate.pollNext().get());
Thread.sleep(10);
}
long alignmentTime = validator.lastAlignmentDurationNanos.get() / 1_000_000;
assertThat(alignmentTime, greaterThan(0L));
assertThat(alignmentTime, lessThan(30L));
// Checkpoint 1
assertEquals(sequence[0], inputGate.pollNext().get());

long beforeSecondCheckpointStartTime = System.nanoTime();
// Checkpoint 2
assertEquals(sequence[1], inputGate.pollNext().get());
long afterSecondCheckpointStartTime = System.nanoTime();
// Cancellation checkpoint 1
assertEquals(sequence[2], inputGate.pollNext().get());
long beforeSecondCheckpointEndTime = System.nanoTime();
// Finishing checkpoint 2
assertEquals(sequence[3], inputGate.pollNext().get());
long afterSecondCheckpointEndTime = System.nanoTime();

long alignmentTime = validator.lastAlignmentDurationNanos.get();
assertThat(
alignmentTime,
greaterThanOrEqualTo(
beforeSecondCheckpointEndTime - afterSecondCheckpointStartTime));
assertThat(
alignmentTime,
lessThanOrEqualTo(afterSecondCheckpointEndTime - beforeSecondCheckpointStartTime));
}

@Test
Expand Down