KAFKA-20553: Use ClusterInstance for streams group command tests#22701
Open
FrankYang0529 wants to merge 1 commit into
Open
KAFKA-20553: Use ClusterInstance for streams group command tests#22701FrankYang0529 wants to merge 1 commit into
FrankYang0529 wants to merge 1 commit into
Conversation
Signed-off-by: PoAn Yang <payang@apache.org>
chia7712
reviewed
Jun 30, 2026
| configs.put(StreamsConfig.DEFAULT_KEY_SERDE_CLASS_CONFIG, Serdes.StringSerde.class); | ||
| configs.put(StreamsConfig.DEFAULT_VALUE_SERDE_CLASS_CONFIG, Serdes.StringSerde.class); | ||
| configs.put(StreamsConfig.GROUP_PROTOCOL_CONFIG, GroupProtocol.STREAMS.name().toLowerCase(Locale.getDefault())); | ||
| configs.put(StreamsConfig.GROUP_PROTOCOL_CONFIG, "streams"); |
chia7712
reviewed
Jun 30, 2026
| List<Future<RecordMetadata>> futures = new ArrayList<>(); | ||
| for (KeyValueTimestamp<String, String> record : toProduce) { | ||
| futures.add(producer.send( | ||
| new ProducerRecord<>(topic, partition.orElse(null), record.timestamp(), record.key(), record.value(), null))); |
Member
There was a problem hiding this comment.
public static void produce(final ClusterInstance instance,
final String topic,
final Optional<Integer> partition,
final List<KeyValueTimestamp<String, String>> toProduce) {
try (Producer<String, String> producer = instance.producer(Map.of(
ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringSerializer.class.getName(),
ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, StringSerializer.class.getName()
))) {
var futures = toProduce.stream()
.map(record -> producer.send(new ProducerRecord<>(topic, partition.orElse(null),
record.timestamp(), record.key(), record.value())))
.toList();
producer.flush();
futures.forEach(f -> Assertions.assertDoesNotThrow(() -> f.get()));
}
}| } | ||
|
|
||
| @Test | ||
| @ClusterTest |
Member
There was a problem hiding this comment.
It does not need the ClusterInstance, right?
| } | ||
| cluster.createTopic(INPUT_TOPIC, 2, (short) 1); | ||
| try (KafkaStreams ignored = startStreamsApp()) { | ||
| try (StreamsGroupCommand.StreamsGroupService service = getStreamsGroupService(new String[]{"--bootstrap-server", cluster.bootstrapServers(), "--list", "--state", "stable"})) { |
Member
There was a problem hiding this comment.
Could we consolidate these try-catch blocks into a single one?
| } | ||
|
|
||
| @Test | ||
| @ClusterTest |
Member
There was a problem hiding this comment.
ditto. Does it need to have a cluster instance?
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Followup from:
#22521 (comment)
Migrate the streams group command integration tests from
EmbeddedKafkaClusterto theClusterInstancetest framework:Reviewers: Chia-Ping Tsai chia7712@gmail.com