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

KAFKA-12323 Follow-up: Refactor the unit test a bit #10205

Merged
merged 3 commits into from Mar 1, 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
Expand Up @@ -1844,19 +1844,17 @@ public void process(final Object key, final Object value) {}
assertEquals(0, punctuatedWallClockTime.size());

mockTime.sleep(100L);
for (long i = 0L; i < 10L; i++) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we remove this loop?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we do not need it really: a single record is sufficient to trigger the punctuation.

clientSupplier.consumer.addRecord(new ConsumerRecord<>(
topic1,
1,
i,
i * 100L,
TimestampType.CREATE_TIME,
ConsumerRecord.NULL_CHECKSUM,
("K" + i).getBytes().length,
("V" + i).getBytes().length,
("K" + i).getBytes(),
("V" + i).getBytes()));
}
clientSupplier.consumer.addRecord(new ConsumerRecord<>(
topic1,
1,
100L,
100L,
TimestampType.CREATE_TIME,
ConsumerRecord.NULL_CHECKSUM,
"K".getBytes().length,
"V".getBytes().length,
"K".getBytes(),
"V".getBytes()));

thread.runOnce();

Expand Down Expand Up @@ -1936,19 +1934,19 @@ public void process(final Object key, final Object value) {
clientSupplier.consumer.addRecord(new ConsumerRecord<>(
topic1,
1,
0L,
100L,
TimestampType.CREATE_TIME,
ConsumerRecord.NULL_CHECKSUM,
"K".getBytes().length,
"V".getBytes().length,
"K".getBytes(),
"V".getBytes()));
110L,
110L,
TimestampType.CREATE_TIME,
ConsumerRecord.NULL_CHECKSUM,
"K".getBytes().length,
"V".getBytes().length,
"K".getBytes(),
"V".getBytes()));

thread.runOnce();

assertEquals(2, peekedContextTime.size());
assertEquals(0L, peekedContextTime.get(1).longValue());
assertEquals(110L, peekedContextTime.get(1).longValue());
}

@Test
Expand Down