Skip to content

Commit d68c41d

Browse files
authored
KAFKA-19666: Clean up integration tests related to state-updater (#20462)
Clean up `KafkaStreamsTelemetryIntegrationTest.java` Reviewers: Lucas Brutschy <[email protected]>
1 parent 37e04ec commit d68c41d

File tree

1 file changed

+16
-27
lines changed

1 file changed

+16
-27
lines changed

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

Lines changed: 16 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
import org.junit.jupiter.api.BeforeAll;
6666
import org.junit.jupiter.api.BeforeEach;
6767
import org.junit.jupiter.api.Tag;
68+
import org.junit.jupiter.api.Test;
6869
import org.junit.jupiter.api.TestInfo;
6970
import org.junit.jupiter.api.Timeout;
7071
import org.junit.jupiter.params.ParameterizedTest;
@@ -174,7 +175,7 @@ public void tearDown() throws Exception {
174175
@ParameterizedTest
175176
@MethodSource("recordingLevelParameters")
176177
public void shouldPushGlobalThreadMetricsToBroker(final String recordingLevel, final String groupProtocol) throws Exception {
177-
streamsApplicationProperties = props(true, groupProtocol);
178+
streamsApplicationProperties = props(groupProtocol);
178179
streamsApplicationProperties.put(StreamsConfig.METRICS_RECORDING_LEVEL_CONFIG, recordingLevel);
179180
final Topology topology = simpleTopology(true);
180181
subscribeForStreamsMetrics();
@@ -213,7 +214,7 @@ public void shouldPushGlobalThreadMetricsToBroker(final String recordingLevel, f
213214
@MethodSource("recordingLevelParameters")
214215
public void shouldPushMetricsToBroker(final String recordingLevel, final String groupProtocol) throws Exception {
215216
// End-to-end test validating metrics pushed to broker
216-
streamsApplicationProperties = props(true, groupProtocol);
217+
streamsApplicationProperties = props(groupProtocol);
217218
streamsApplicationProperties.put(StreamsConfig.METRICS_RECORDING_LEVEL_CONFIG, recordingLevel);
218219
final Topology topology = simpleTopology(false);
219220
subscribeForStreamsMetrics();
@@ -274,10 +275,10 @@ public void shouldPushMetricsToBroker(final String recordingLevel, final String
274275
}
275276

276277
@ParameterizedTest
277-
@MethodSource("singleAndMultiTaskParameters")
278-
public void shouldPassMetrics(final String topologyType, final boolean stateUpdaterEnabled, final String groupProtocol) throws Exception {
278+
@MethodSource("topologyComplexityAndRebalanceProtocol")
279+
public void shouldPassMetrics(final String topologyType, final String groupProtocol) throws Exception {
279280
// Streams metrics should get passed to Admin and Consumer
280-
streamsApplicationProperties = props(stateUpdaterEnabled, groupProtocol);
281+
streamsApplicationProperties = props(groupProtocol);
281282
final Topology topology = topologyType.equals("simple") ? simpleTopology(false) : complexTopology();
282283

283284
try (final KafkaStreams streams = new KafkaStreams(topology, streamsApplicationProperties)) {
@@ -303,16 +304,15 @@ public void shouldPassMetrics(final String topologyType, final boolean stateUpda
303304
}
304305
}
305306

306-
@ParameterizedTest
307-
@MethodSource("multiTaskParameters")
308-
public void shouldPassCorrectMetricsDynamicInstances(final boolean stateUpdaterEnabled, final String groupProtocol) throws Exception {
307+
@Test
308+
public void shouldPassCorrectMetricsDynamicInstances() throws Exception {
309309
// Correct streams metrics should get passed with dynamic membership
310-
streamsApplicationProperties = props(stateUpdaterEnabled, groupProtocol);
310+
streamsApplicationProperties = props("classic");
311311
streamsApplicationProperties.put(StreamsConfig.STATE_DIR_CONFIG, TestUtils.tempDirectory(appId).getPath() + "-ks1");
312312
streamsApplicationProperties.put(StreamsConfig.CLIENT_ID_CONFIG, appId + "-ks1");
313313

314314

315-
streamsSecondApplicationProperties = props(stateUpdaterEnabled, groupProtocol);
315+
streamsSecondApplicationProperties = props("classic");
316316
streamsSecondApplicationProperties.put(StreamsConfig.STATE_DIR_CONFIG, TestUtils.tempDirectory(appId).getPath() + "-ks2");
317317
streamsSecondApplicationProperties.put(StreamsConfig.CLIENT_ID_CONFIG, appId + "-ks2");
318318

@@ -407,7 +407,7 @@ public void shouldPassCorrectMetricsDynamicInstances(final boolean stateUpdaterE
407407
@ValueSource(strings = {"classic", "streams"})
408408
public void passedMetricsShouldNotLeakIntoClientMetrics(final String groupProtocol) throws Exception {
409409
// Streams metrics should not be visible in client metrics
410-
streamsApplicationProperties = props(true, groupProtocol);
410+
streamsApplicationProperties = props(groupProtocol);
411411
final Topology topology = complexTopology();
412412

413413
try (final KafkaStreams streams = new KafkaStreams(topology, streamsApplicationProperties)) {
@@ -444,27 +444,16 @@ private List<String> getTaskIdsAsStrings(final KafkaStreams streams) {
444444
.toList();
445445
}
446446

447-
private static Stream<Arguments> singleAndMultiTaskParameters() {
448-
return Stream.of(
449-
Arguments.of("simple", true, "classic"),
450-
Arguments.of("simple", false, "classic"),
451-
Arguments.of("complex", true, "classic"),
452-
Arguments.of("complex", false, "classic"),
453-
Arguments.of("simple", true, "streams"),
454-
Arguments.of("simple", false, "streams")
455-
);
456-
}
457-
458-
private static Stream<Arguments> multiTaskParameters() {
447+
private static Stream<Arguments> topologyComplexityAndRebalanceProtocol() {
459448
return Stream.of(
460-
Arguments.of(true, "classic"),
461-
Arguments.of(false, "classic")
449+
Arguments.of("simple", "classic"),
450+
Arguments.of("complex", "classic"),
451+
Arguments.of("simple", "streams")
462452
);
463453
}
464454

465-
private Properties props(final boolean stateUpdaterEnabled, final String groupProtocol) {
455+
private Properties props(final String groupProtocol) {
466456
return props(mkObjectProperties(mkMap(
467-
mkEntry(StreamsConfig.InternalConfig.STATE_UPDATER_ENABLED, stateUpdaterEnabled),
468457
mkEntry(StreamsConfig.GROUP_PROTOCOL_CONFIG, groupProtocol)
469458
)));
470459
}

0 commit comments

Comments
 (0)