KAFKA-20329: Test headers dsl.store.format further (4/N)#21827
KAFKA-20329: Test headers dsl.store.format further (4/N)#21827aliehsaeedii wants to merge 5 commits intoapache:trunkfrom
Conversation
6ab5990 to
9488168
Compare
|
A label of 'needs-attention' was automatically added to this PR in order to raise the |
| setUp(withHeaders); | ||
| final StreamsBuilder builder = new StreamsBuilder(); | ||
| final Properties props = new Properties(); | ||
| props.put(StreamsConfig.TOPOLOGY_OPTIMIZATION_CONFIG, StreamsConfig.NO_OPTIMIZATION); |
There was a problem hiding this comment.
Not sure why we did disable this explicitly as it's disabled by default -- seems we have similar stuff in other tests on this class. Should we also remove it? -- Any reason why you remove it here, but not elsewhere?
Still wondering, why we have this explicit disabling 🤔
| setUp(withHeaders); | ||
| final StreamsBuilder builder = new StreamsBuilder(); | ||
| final Properties props = new Properties(); | ||
| props.put(StreamsConfig.TOPOLOGY_OPTIMIZATION_CONFIG, StreamsConfig.NO_OPTIMIZATION); |
| public void shouldNotFailIfTableIsVersionedButMaterializationIsInherited(final boolean withHeaders) { | ||
| setUp(withHeaders); | ||
| final StreamsBuilder builder = new StreamsBuilder(); | ||
| final Properties props = new Properties(); |
There was a problem hiding this comment.
setUp create it's own local Properties which is passed into TTD. So if we create new one here, that we need to pass into builder.build() below, why do we need to call setUp() at all?
This pattern of calling setUp and using local Properties is on other methods, too.
There was a problem hiding this comment.
setUp must be called on every test as it used to be a @beforeEach method
|
|
||
| //should not throw an error | ||
| builder.build(); | ||
| builder.build(props); |
There was a problem hiding this comment.
Why do we need to pass in props now, but not before? I understand that the "headers" flag is a DSL config, so if the build(...) method needs that we pass props to pick it up, it seems we need to make this change everywhere to actually enable header store? This would also apply to your other PRs (maybe even the already merged N/2? -- If we need to pass in here, all your other changes seems to actually not enable header stores?
| public void shouldHaveMultipleSessionsForSameIdWhenTimestampApartBySessionGap(final EmitStrategy.StrategyType inputType, final boolean enableCaching, final boolean withHeaders) { | ||
| setup(inputType, enableCaching, withHeaders); | ||
| // This test expects caching behavior for accurate result counts | ||
| if (!enableCaching && !emitFinal) { |
There was a problem hiding this comment.
Why do we run this test only with caching disabled, and emit-on-change, but not with emit-on-final? Seems the original test setup did includ emit-on-final?
There was a problem hiding this comment.
The original test considers caching as enabled:
| public void shouldHandleMultipleSessionsAndMerging(final EmitStrategy.StrategyType inputType, final boolean enableCaching, final boolean withHeaders) { | ||
| setup(inputType, enableCaching, withHeaders); | ||
| // This test expects caching behavior for accurate result counts | ||
| if (!enableCaching && !emitFinal) { |
There was a problem hiding this comment.
the same as above:
| props.putAll(CONFIG); | ||
| props.putAll(StreamsTestUtils.getStreamsConfig(Serdes.String(), Serdes.String())); | ||
| props.put(StreamsConfig.DSL_STORE_FORMAT_CONFIG, StreamsConfig.DSL_STORE_FORMAT_HEADERS); | ||
| builder = new StreamsBuilder(new TopologyConfig(new StreamsConfig(props))); |
There was a problem hiding this comment.
Do we actually need this change at all, given that versions stores don't support headers yet?
| @MethodSource("data") | ||
| public void testCountOfVersionedStore(final boolean withHeaders) { | ||
| final StreamsBuilder builder; | ||
| if (withHeaders) { |
|
|
||
| @BeforeEach | ||
| public void setUp() { | ||
| public void setUp(final boolean withHeaders) { |
There was a problem hiding this comment.
Does it make sense to parameterize this test (same question for "sliding" and "windowed" case). This test already has explicit setup to test w/ and w/o header stores, for different test methods.
mjsax
left a comment
There was a problem hiding this comment.
Thanks for the PR. Made a pass.
9488168 to
162d4ad
Compare
| private boolean emitFinal; | ||
|
|
||
| private void setup(final EmitStrategy.StrategyType inputType, final boolean enableCaching) { | ||
| public static Stream<Arguments> data() { |
There was a problem hiding this comment.
Could we have some meaningful name?
for example emitStrategyAndCachingMatrix
| @@ -92,14 +92,22 @@ public class KStreamSlidingWindowAggregateTest { | |||
|
|
|||
| public static Stream<Arguments> data() { | |||
There was a problem hiding this comment.
ditto, we should rename it.
| private boolean emitFinal; | ||
|
|
||
| public static Stream<Arguments> getEmitStrategy() { | ||
| public static Stream<Arguments> data() { |
| mkEntry(StreamsConfig.STATE_DIR_CONFIG, TestUtils.tempDirectory("kafka-test").getAbsolutePath()))); | ||
|
|
||
| private StreamsBuilder createStreamBuilderInMemory() { | ||
|
|
|
|
||
| @BeforeEach | ||
| public void setUp() { | ||
| private void setupProps(final boolean withHeaders) { |
There was a problem hiding this comment.
nit:
I suppose we could keep the original name.
| assertThat(outputTopic.readRecord(), equalTo(new TestRecord<>(expectedKey, expectedValue, null, expectedTimestamp))); | ||
| } | ||
|
|
||
| private void setDslStoreFormat(final boolean withHeaders) { |
There was a problem hiding this comment.
I noticed there's Javadoc for this method in other test files. I’m fine with or without it—up to you—but the key is to stay consistent.
| assertThat(outputTopic.readRecord(), equalTo(new TestRecord<>(expectedKey, expectedValue, null, expectedTimestamp))); | ||
| } | ||
|
|
||
| private void setDslStoreFormat(final boolean withHeaders) { |
| } | ||
| } | ||
|
|
||
| private void setDslStoreFormat(final boolean withHeaders) { |
| } | ||
| } | ||
|
|
||
| private void setDslStoreFormat(final boolean withHeaders) { |
| } | ||
| } | ||
|
|
||
| private void setDslStoreFormat(final boolean withHeaders) { |
|
retrigger CI |
Parametrized 28 DSL and processor test classes to validate functionality with both
headersanddefaultstore configurations. This ensures backward compatibility and correctness as Kafka Streams transitions to supporting record headers in state stores.Modified Tests: