Skip to content

Commit dd824a2

Browse files
authored
KAFKA-19666: Remove old restoration codepath from RestoreIntegrationTest [4/N] (#20498)
Clean up `RestoreIntegrationTest.java` Reviewers: Lucas Brutschy <[email protected]>
1 parent 8a79ea2 commit dd824a2

File tree

1 file changed

+21
-53
lines changed

1 file changed

+21
-53
lines changed

streams/integration-tests/src/test/java/org/apache/kafka/streams/integration/RestoreIntegrationTest.java

Lines changed: 21 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
import org.apache.kafka.streams.KeyValue;
4444
import org.apache.kafka.streams.StreamsBuilder;
4545
import org.apache.kafka.streams.StreamsConfig;
46-
import org.apache.kafka.streams.StreamsConfig.InternalConfig;
4746
import org.apache.kafka.streams.Topology;
4847
import org.apache.kafka.streams.integration.utils.EmbeddedKafkaCluster;
4948
import org.apache.kafka.streams.integration.utils.IntegrationTestUtils;
@@ -77,7 +76,6 @@
7776
import org.junit.jupiter.api.TestInfo;
7877
import org.junit.jupiter.api.Timeout;
7978
import org.junit.jupiter.params.ParameterizedTest;
80-
import org.junit.jupiter.params.provider.CsvSource;
8179
import org.junit.jupiter.params.provider.ValueSource;
8280
import org.slf4j.Logger;
8381
import org.slf4j.LoggerFactory;
@@ -161,8 +159,8 @@ public void createTopics(final TestInfo testInfo) throws InterruptedException {
161159
CLUSTER.createTopic(inputStream, 2, 1);
162160
}
163161

164-
private Properties props(final boolean stateUpdaterEnabled) {
165-
return props(mkObjectProperties(mkMap(mkEntry(InternalConfig.STATE_UPDATER_ENABLED, stateUpdaterEnabled))));
162+
private Properties props() {
163+
return props(mkObjectProperties(mkMap()));
166164
}
167165

168166
private Properties props(final Properties extraProperties) {
@@ -267,17 +265,12 @@ public void shouldRestoreNullRecord(final boolean useNewProtocol) throws Excepti
267265
}
268266

269267
@ParameterizedTest
270-
@CsvSource({
271-
"true,true",
272-
"true,false",
273-
"false,true",
274-
"false,false"
275-
})
276-
public void shouldRestoreStateFromSourceTopicForReadOnlyStore(final boolean stateUpdaterEnabled, final boolean useNewProtocol) throws Exception {
268+
@ValueSource(booleans = {true, false})
269+
public void shouldRestoreStateFromSourceTopicForReadOnlyStore(final boolean useNewProtocol) throws Exception {
277270
final AtomicInteger numReceived = new AtomicInteger(0);
278271
final Topology topology = new Topology();
279272

280-
final Properties props = props(stateUpdaterEnabled);
273+
final Properties props = props();
281274
if (useNewProtocol) {
282275
props.put(StreamsConfig.GROUP_PROTOCOL_CONFIG, GroupProtocol.STREAMS.name());
283276
}
@@ -338,17 +331,12 @@ public void shouldRestoreStateFromSourceTopicForReadOnlyStore(final boolean stat
338331
}
339332

340333
@ParameterizedTest
341-
@CsvSource({
342-
"true,true",
343-
"true,false",
344-
"false,true",
345-
"false,false"
346-
})
347-
public void shouldRestoreStateFromSourceTopicForGlobalTable(final boolean stateUpdaterEnabled, final boolean useNewProtocol) throws Exception {
334+
@ValueSource(booleans = {true, false})
335+
public void shouldRestoreStateFromSourceTopicForGlobalTable(final boolean useNewProtocol) throws Exception {
348336
final AtomicInteger numReceived = new AtomicInteger(0);
349337
final StreamsBuilder builder = new StreamsBuilder();
350338

351-
final Properties props = props(stateUpdaterEnabled);
339+
final Properties props = props();
352340
props.put(StreamsConfig.TOPOLOGY_OPTIMIZATION_CONFIG, StreamsConfig.OPTIMIZE);
353341
if (useNewProtocol) {
354342
props.put(StreamsConfig.GROUP_PROTOCOL_CONFIG, GroupProtocol.STREAMS.name());
@@ -413,20 +401,15 @@ public void shouldRestoreStateFromSourceTopicForGlobalTable(final boolean stateU
413401
}
414402

415403
@ParameterizedTest
416-
@CsvSource({
417-
"true,true",
418-
"true,false",
419-
"false,true",
420-
"false,false"
421-
})
422-
public void shouldRestoreStateFromChangelogTopic(final boolean stateUpdaterEnabled, final boolean useNewProtocol) throws Exception {
404+
@ValueSource(booleans = {true, false})
405+
public void shouldRestoreStateFromChangelogTopic(final boolean useNewProtocol) throws Exception {
423406
final String changelog = appId + "-store-changelog";
424407
CLUSTER.createTopic(changelog, 2, 1);
425408

426409
final AtomicInteger numReceived = new AtomicInteger(0);
427410
final StreamsBuilder builder = new StreamsBuilder();
428411

429-
final Properties props = props(stateUpdaterEnabled);
412+
final Properties props = props();
430413

431414
if (useNewProtocol) {
432415
props.put(StreamsConfig.GROUP_PROTOCOL_CONFIG, GroupProtocol.STREAMS.name());
@@ -474,13 +457,8 @@ public void shouldRestoreStateFromChangelogTopic(final boolean stateUpdaterEnabl
474457
}
475458

476459
@ParameterizedTest
477-
@CsvSource({
478-
"true,true",
479-
"true,false",
480-
"false,true",
481-
"false,false"
482-
})
483-
public void shouldSuccessfullyStartWhenLoggingDisabled(final boolean stateUpdaterEnabled, final boolean useNewProtocol) throws InterruptedException {
460+
@ValueSource(booleans = {true, false})
461+
public void shouldSuccessfullyStartWhenLoggingDisabled(final boolean useNewProtocol) throws InterruptedException {
484462
final StreamsBuilder builder = new StreamsBuilder();
485463

486464
final KStream<Integer, Integer> stream = builder.stream(inputStream);
@@ -490,7 +468,7 @@ public void shouldSuccessfullyStartWhenLoggingDisabled(final boolean stateUpdate
490468
Integer::sum,
491469
Materialized.<Integer, Integer, KeyValueStore<Bytes, byte[]>>as("reduce-store").withLoggingDisabled()
492470
);
493-
final Properties props = props(stateUpdaterEnabled);
471+
final Properties props = props();
494472
if (useNewProtocol) {
495473
props.put(StreamsConfig.GROUP_PROTOCOL_CONFIG, GroupProtocol.STREAMS.name());
496474
}
@@ -503,13 +481,8 @@ public void shouldSuccessfullyStartWhenLoggingDisabled(final boolean stateUpdate
503481
}
504482

505483
@ParameterizedTest
506-
@CsvSource({
507-
"true,true",
508-
"true,false",
509-
"false,true",
510-
"false,false"
511-
})
512-
public void shouldProcessDataFromStoresWithLoggingDisabled(final boolean stateUpdaterEnabled, final boolean useNewProtocol) throws InterruptedException {
484+
@ValueSource(booleans = {true, false})
485+
public void shouldProcessDataFromStoresWithLoggingDisabled(final boolean useNewProtocol) throws InterruptedException {
513486
IntegrationTestUtils.produceKeyValuesSynchronously(inputStream,
514487
asList(KeyValue.pair(1, 1),
515488
KeyValue.pair(2, 2),
@@ -537,7 +510,7 @@ public void shouldProcessDataFromStoresWithLoggingDisabled(final boolean stateUp
537510

538511
final Topology topology = streamsBuilder.build();
539512

540-
final Properties props = props(stateUpdaterEnabled);
513+
final Properties props = props();
541514

542515
if (useNewProtocol) {
543516
props.put(StreamsConfig.GROUP_PROTOCOL_CONFIG, GroupProtocol.STREAMS.name());
@@ -558,13 +531,8 @@ public void shouldProcessDataFromStoresWithLoggingDisabled(final boolean stateUp
558531
}
559532

560533
@ParameterizedTest
561-
@CsvSource({
562-
"true,true",
563-
"true,false",
564-
"false,true",
565-
"false,false"
566-
})
567-
public void shouldRecycleStateFromStandbyTaskPromotedToActiveTaskAndNotRestore(final boolean stateUpdaterEnabled, final boolean useNewProtocol) throws Exception {
534+
@ValueSource(booleans = {true, false})
535+
public void shouldRecycleStateFromStandbyTaskPromotedToActiveTaskAndNotRestore(final boolean useNewProtocol) throws Exception {
568536
final StreamsBuilder builder = new StreamsBuilder();
569537
builder.table(
570538
inputStream,
@@ -576,7 +544,7 @@ public void shouldRecycleStateFromStandbyTaskPromotedToActiveTaskAndNotRestore(f
576544
CLUSTER.setGroupStandbyReplicas(appId, 1);
577545
}
578546

579-
final Properties props1 = props(stateUpdaterEnabled);
547+
final Properties props1 = props();
580548
props1.put(StreamsConfig.NUM_STANDBY_REPLICAS_CONFIG, 1);
581549
props1.put(StreamsConfig.STATE_DIR_CONFIG, TestUtils.tempDirectory(appId + "-1").getPath());
582550
if (useNewProtocol) {
@@ -585,7 +553,7 @@ public void shouldRecycleStateFromStandbyTaskPromotedToActiveTaskAndNotRestore(f
585553
purgeLocalStreamsState(props1);
586554
final KafkaStreams streams1 = new KafkaStreams(builder.build(), props1);
587555

588-
final Properties props2 = props(stateUpdaterEnabled);
556+
final Properties props2 = props();
589557
props2.put(StreamsConfig.NUM_STANDBY_REPLICAS_CONFIG, 1);
590558
props2.put(StreamsConfig.STATE_DIR_CONFIG, TestUtils.tempDirectory(appId + "-2").getPath());
591559
if (useNewProtocol) {

0 commit comments

Comments
 (0)