MINOR: capture result timestamps in Kafka Streams DSL tests#6447
MINOR: capture result timestamps in Kafka Streams DSL tests#6447mjsax merged 2 commits intoapache:trunkfrom
Conversation
|
Call for review @guozhangwang @bbejeck @vvcephei @ableegoldman |
| private String topicName = "topic"; | ||
| private final ConsumerRecordFactory<Integer, String> recordFactory = new ConsumerRecordFactory<>(new IntegerSerializer(), new StringSerializer()); | ||
| private final ConsumerRecordFactory<Integer, String> recordFactory = | ||
| new ConsumerRecordFactory<>(new IntegerSerializer(), new StringSerializer(), 0L); |
There was a problem hiding this comment.
We set the initial timestamp of the factory to zero (similar in other tests).
| assertEquals(6, supplier.theCapturedProcessor().processed.size()); | ||
|
|
||
| final String[] expected = {"10:V1", "20:V2", "21:V2", "30:V3", "31:V3", "32:V3"}; | ||
| final String[] expected = {"10:V1 (ts: 0)", "20:V2 (ts: 0)", "21:V2 (ts: 0)", "30:V3 (ts: 0)", "31:V3 (ts: 0)", "32:V3 (ts: 0)"}; |
There was a problem hiding this comment.
The test of the expected result, also checks the timestamp now. Similar in other tests.
|
|
||
| try (final TopologyTestDriver driver = new TopologyTestDriver(builder.build(), props, 0L)) { | ||
|
|
||
| try (final TopologyTestDriver driver = new TopologyTestDriver(builder.build(), props)) { |
There was a problem hiding this comment.
No need to set initial wall-clock time of the driver (removed to avoid confusion with event-time). Similar on other places.
| } | ||
|
|
||
| processor.checkAndClearProcessResult("0:X0+YY0", "1:X1+YY1", "2:X2+YY2", "3:X3+YY3"); | ||
| processor.checkAndClearProcessResult("0:X0+YY0 (ts: 1100)", "1:X1+YY1 (ts: 1100)", "2:X2+YY2 (ts: 1100)", "3:X3+YY3 (ts: 1100)"); |
There was a problem hiding this comment.
This test does modify timestamps to test window boundaries, thus, result timestamps are not zero.
| } | ||
|
|
||
| processor.checkAndClearProcessResult("0:X0+YY0"); | ||
| processor.checkAndClearProcessResult("0:X0+YY0 (ts: 1000)"); |
| } | ||
|
|
||
| processor.checkAndClearProcessResult("0:X0+YY0"); | ||
| processor.checkAndClearProcessResult("0:X0+YY0 (ts: 900)"); |
| driver.pipeInput(recordFactory.create(topic1, expectedKey, "XX" + expectedKey, time)); | ||
| } | ||
| processor.checkAndClearProcessResult("0:XX0+Y0", "1:XX1+Y1", "2:XX2+Y2", "3:XX3+Y3"); | ||
| processor.checkAndClearProcessResult("0:XX0+Y0 (ts: 1100)", "1:XX1+Y1 (ts: 1100)", "2:XX2+Y2 (ts: 1100)", "3:XX3+Y3 (ts: 1100)"); |
| "[B@5/15]:0+2+2+2+2", "[B@10/20]:0+2+2", | ||
| "[C@5/15]:0+3+3", "[C@10/20]:0+3" | ||
| "[A@0/10]:0+1 (ts: 0)", | ||
| "[B@0/10]:0+2 (ts: 1)", |
There was a problem hiding this comment.
This test sets timestamps explicitly so we get non-zero timestamps.
| processed.add( | ||
| (key == null ? "null" : key) + | ||
| ":" + (value == null ? "null" : value) + | ||
| " (ts: " + context().timestamp() + ")" |
There was a problem hiding this comment.
This is the actual change of this PR to capture the result timestamp.
|
@mjsax test failures seem related, but from looking at the results the values are the same but it looks like the comparison is asserting instance equality. |
|
Fixed, by adding timestamps comparison. |
|
LGTM! |
* apache/trunk: (23 commits) KAFKA-7986: Distinguish logging from different ZooKeeperClient instances (apache#6493) KAFKA-8102: Add an interval-based Trogdor transaction generator (apache#6444) MINOR: Fix misspelling in protocol documentation KAFKA-8150: Fix bugs in handling null arrays in generated RPC code (apache#6489) KAFKA-8014: Extend Connect integration tests to add and remove workers dynamically (apache#6342) MINOR: Remove line for testing repartition topic name (apache#6488) MINOR: add MacOS requirement to Streams docs MINOR: fix message protocol help text for ElectPreferredLeadersResult (apache#6479) MINOR: list-topics should not require topic param MINOR: Clean up ThreadCacheTest (apache#6485) MINOR: Avoid unnecessary collection copy in MetadataCache (apache#6397) KAFKA-8142: Fix NPE for nulls in Headers (apache#6484) KAFKA-7243: Add unit integration tests to validate metrics in Kafka Streams (apache#6080) MINOR: Add verification step for Streams archetype to Jenkins build (apache#6431) KAFKA-7819: Improve RoundTripWorker (apache#6187) KAFKA-7989: RequestQuotaTest should wait for quota config change before running tests (apache#6482) KAFKA-8098: Fix Flaky Test testConsumerGroups KAFKA-6958: Add new NamedOperation interface to enforce consistency in naming operations (apache#6409) MINOR: capture result timestamps in Kafka Streams DSL tests (apache#6447) MINOR: updated names for deprecated streams constants (apache#6466) ...
To enable proper testing of timestamp propagation in the DSL, this PR updates
MockProcessorto capture the record timestamp.All tests using
MockProcessorneed to be updated accordingly. This PR only sets most timestamps to zero for now. When we update the DSL semantics, those test will gradually be updated accordingly.Some code cleanup on the side (Java8 rewrites, reformatting, getting rid of warnings.)