-
Notifications
You must be signed in to change notification settings - Fork 15.4k
KAFKA-20629: Add ducktape system tests for topology description plugin #22769
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
lucliu1108
wants to merge
13
commits into
apache:trunk
Choose a base branch
from
lucliu1108:lucliu/KAFKA-20629-part-1
base: trunk
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
02ad10f
KAFKA-20629: Add ducktape system tests for topology description plugi…
lucliu1108 be35f9e
add hb unstable api version
lucliu1108 897509c
revise comment
lucliu1108 de2749f
remove unnecessary enable unstable version
lucliu1108 d88e1ac
modify import orders
lucliu1108 22caa6b
KAFKA-20629: Enable topology description plugin in existing streams s…
lucliu1108 e9e6251
revise new dev version
lucliu1108 ecd4ea8
fix style
lucliu1108 83289f0
stash part2 change to 1
lucliu1108 7a0e8f4
revise test
lucliu1108 6d24778
modify error messages
lucliu1108 cc5bad7
add additional broker side log assertion for client-plugin-disabled case
lucliu1108 d767996
add broker side log and confirmation for configuration set
lucliu1108 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
88 changes: 88 additions & 0 deletions
88
...ams/src/test/java/org/apache/kafka/streams/tests/TopologyDescriptionPluginSystemTest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,88 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one or more | ||
| * contributor license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright ownership. | ||
| * The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| * (the "License"); you may not use this file except in compliance with | ||
| * the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| package org.apache.kafka.streams.tests; | ||
|
|
||
| import org.apache.kafka.common.serialization.Serdes; | ||
| import org.apache.kafka.common.utils.Utils; | ||
| import org.apache.kafka.common.utils.internals.Exit; | ||
| import org.apache.kafka.streams.KafkaStreams; | ||
| import org.apache.kafka.streams.StreamsBuilder; | ||
| import org.apache.kafka.streams.StreamsConfig; | ||
| import org.apache.kafka.streams.errors.StreamsUncaughtExceptionHandler; | ||
| import org.apache.kafka.streams.kstream.Consumed; | ||
| import org.apache.kafka.streams.kstream.Produced; | ||
|
|
||
| import java.io.IOException; | ||
| import java.time.Duration; | ||
| import java.util.Locale; | ||
| import java.util.Properties; | ||
|
|
||
| public class TopologyDescriptionPluginSystemTest { | ||
|
|
||
| private static final String APPLICATION_ID = "kafka-streams-system-test-topology-description-plugin"; | ||
| private static final String SOURCE_TOPIC = "topologyDescriptionPluginSource"; | ||
| private static final String SINK_TOPIC = "topologyDescriptionPluginSink"; | ||
|
|
||
| public static void main(final String[] args) throws IOException { | ||
| if (args.length != 1) { | ||
| System.err.println("TopologyDescriptionPluginSystemTest expects one parameter: propFile"); | ||
| Exit.exit(1); | ||
| } | ||
|
|
||
| System.out.println("TopologyDescriptionPluginSystemTest starting"); | ||
|
|
||
| final String propFileName = args[0]; | ||
| final Properties streamsProperties = Utils.loadProps(propFileName); | ||
| final String bootstrap = streamsProperties.getProperty(StreamsConfig.BOOTSTRAP_SERVERS_CONFIG); | ||
|
|
||
| if (bootstrap == null) { | ||
| System.err.println("No bootstrap kafka servers specified in " + StreamsConfig.BOOTSTRAP_SERVERS_CONFIG); | ||
| Exit.exit(1); | ||
| } | ||
|
|
||
| streamsProperties.put(StreamsConfig.APPLICATION_ID_CONFIG, APPLICATION_ID); | ||
| streamsProperties.put(StreamsConfig.DEFAULT_KEY_SERDE_CLASS_CONFIG, Serdes.String().getClass()); | ||
| streamsProperties.put(StreamsConfig.DEFAULT_VALUE_SERDE_CLASS_CONFIG, Serdes.String().getClass()); | ||
|
|
||
| final StreamsBuilder builder = new StreamsBuilder(); | ||
| builder.<String, String>stream(SOURCE_TOPIC, Consumed.with(Serdes.String(), Serdes.String())) | ||
| .mapValues(value -> value.toLowerCase(Locale.ROOT)) | ||
| .groupByKey() | ||
| .count() | ||
| .toStream() | ||
| .mapValues(count -> Long.toString(count)) | ||
| .to(SINK_TOPIC, Produced.with(Serdes.String(), Serdes.String())); | ||
|
|
||
| final KafkaStreams streams = new KafkaStreams(builder.build(), streamsProperties); | ||
| streams.setUncaughtExceptionHandler(e -> { | ||
| System.err.println("FATAL: An unexpected exception " + e); | ||
| System.err.flush(); | ||
| return StreamsUncaughtExceptionHandler.StreamThreadExceptionResponse.SHUTDOWN_CLIENT; | ||
| }); | ||
|
|
||
| System.out.println("Start Kafka Streams"); | ||
| streams.start(); | ||
| System.out.println("STREAMS-STARTED"); | ||
| System.out.flush(); | ||
|
|
||
| Exit.addShutdownHook("streams-shutdown-hook", () -> { | ||
| streams.close(Duration.ofSeconds(30)); | ||
| System.out.println("TopologyDescriptionPluginSystemTest closed"); | ||
| System.out.flush(); | ||
| }); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR description says the plugin is enabled "for DEV_VERSION", but this override applies to every broker version in the matrix. It happens to work because
group.streams.topology.description.plugin.classonly exists on trunk (not in 4.3 or earlier), so older brokers just log an unknown-config warning and ignore it — but that's subtle enough to deserve an inline comment.Also, since
StreamsBrokerCompatibilityServiceruns with the classic protocol (no streams groups exist in this test), the plugin is instantiated but never exercised. Could you clarify what this addition is meant to verify — that a DEV broker with the plugin configured doesn't affect classic-protocol streams apps? A short comment stating that intent would help.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix: I added comments about this config: 1) it is only in actual effect when
broker_version>4.32) This test is only using classic group so the plugin is not taking effect.