Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,8 @@ public String metricsScope() {
})
);

// Discard the basic streams and replace with test-specific topology
kafkaStreams.close();
kafkaStreams = new KafkaStreams(builder.build(), streamsConfiguration(testInfo));
kafkaStreams.cleanUp();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,12 @@ public void shouldBeAbleToProvideInitialMetricValueToMetricsReporter() {
builder.stream(STREAM_INPUT, Consumed.with(Serdes.Integer(), Serdes.String()))
.to(STREAM_OUTPUT, Produced.with(Serdes.Integer(), Serdes.String()));
final Topology topology = builder.build();
final KafkaStreams kafkaStreams = new KafkaStreams(topology, streamsConfiguration);

kafkaStreams.metrics().keySet().forEach(metricName -> {
final Object initialMetricValue = METRIC_NAME_TO_INITIAL_VALUE.get(metricName.name());
assertThat(initialMetricValue, notNullValue());
});
try (KafkaStreams kafkaStreams = new KafkaStreams(topology, streamsConfiguration)) {
kafkaStreams.metrics().keySet().forEach(metricName -> {
final Object initialMetricValue = METRIC_NAME_TO_INITIAL_VALUE.get(metricName.name());
assertThat(initialMetricValue, notNullValue());
});
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,7 @@ public void shouldAddToEmptyInitialTopologyRemoveResetOffsetsThenAddSameNamedTop

@Test
public void shouldContinueProcessingOtherTopologiesWhenNewTopologyHasMissingInputTopics() throws Exception {
// This test leaks sockets due to KAFKA-15834
try {
CLUSTER.createTopic(EXISTING_STREAM, 2, 1);
produceToInputTopics(EXISTING_STREAM, STANDARD_INPUT_DATA);
Expand Down Expand Up @@ -839,6 +840,8 @@ public void shouldBackOffTaskAndEmitDataWithinSameTopology() throws Exception {
props.put(StreamsConfig.DEFAULT_KEY_SERDE_CLASS_CONFIG, Serdes.IntegerSerde.class);
props.put(StreamsConfig.DEFAULT_VALUE_SERDE_CLASS_CONFIG, Serdes.StringSerde.class);

// Discard the pre-created streams and replace with test-specific topology
streams.close();
streams = new KafkaStreamsNamedTopologyWrapper(props);
streams.setUncaughtExceptionHandler(exception -> StreamThreadExceptionResponse.REPLACE_THREAD);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,9 @@ public void setup() {

@AfterEach
public void shutdown() {
if (adminClient != null) {
adminClient.close();
}
if (kafkaStreams != null) {
kafkaStreams.close(Duration.ofSeconds(30));
}
Expand Down