Skip to content

Commit a222266

Browse files
[KIP-848] Tests for ListGroups filter to list only given group types (#4861)
* [KIP-848] Tests for ListGroups filter to list only given group types * Fix doxygen tags order * Improve ' test_ListConsumerGroups_helper' documentation --------- Co-authored-by: mahajanadhitya <[email protected]>
1 parent dd421b3 commit a222266

File tree

3 files changed

+217
-129
lines changed

3 files changed

+217
-129
lines changed

src/rdkafka.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5315,9 +5315,9 @@ rd_kafka_consumer_group_type_name(rd_kafka_consumer_group_type_t type);
53155315
*
53165316
* @param name The group type name.
53175317
*
5318-
* @remark The comparison is case-insensitive.
5319-
*
53205318
* @return The group type value corresponding to the provided group type name.
5319+
*
5320+
* @remark The comparison is case-insensitive.
53215321
*/
53225322
RD_EXPORT
53235323
rd_kafka_consumer_group_type_t

tests/0080-admin_ut.c

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -528,22 +528,44 @@ static void do_test_ListConsumerGroups(const char *what,
528528
q = useq ? useq : rd_kafka_queue_new(rk);
529529

530530
if (with_options) {
531-
rd_kafka_consumer_group_state_t duplicate[2] = {
531+
rd_kafka_error_t *error;
532+
rd_kafka_consumer_group_state_t duplicate_states[2] = {
532533
RD_KAFKA_CONSUMER_GROUP_STATE_EMPTY,
533534
RD_KAFKA_CONSUMER_GROUP_STATE_EMPTY};
535+
rd_kafka_consumer_group_type_t duplicate_types[2] = {
536+
RD_KAFKA_CONSUMER_GROUP_TYPE_CLASSIC,
537+
RD_KAFKA_CONSUMER_GROUP_TYPE_CLASSIC};
538+
rd_kafka_consumer_group_type_t unknown_type[1] = {
539+
RD_KAFKA_CONSUMER_GROUP_TYPE_UNKNOWN};
534540

535541
options = rd_kafka_AdminOptions_new(
536542
rk, RD_KAFKA_ADMIN_OP_LISTCONSUMERGROUPS);
537543

538544
/* Test duplicate error on match states */
539-
rd_kafka_error_t *error =
540-
rd_kafka_AdminOptions_set_match_consumer_group_states(
541-
options, duplicate, 2);
545+
error = rd_kafka_AdminOptions_set_match_consumer_group_states(
546+
options, duplicate_states, 2);
542547
TEST_ASSERT(error && rd_kafka_error_code(error), "%s",
543548
"Expected error on duplicate states,"
544549
" got no error");
545550
rd_kafka_error_destroy(error);
546551

552+
/* Test duplicate error on match group types */
553+
error = rd_kafka_AdminOptions_set_match_consumer_group_types(
554+
options, duplicate_types, 2);
555+
TEST_ASSERT(error && rd_kafka_error_code(error), "%s",
556+
"Expected error on duplicate group types,"
557+
" got no error");
558+
rd_kafka_error_destroy(error);
559+
560+
/* Test invalid args error on setting UNKNOWN group type in
561+
* match group types */
562+
error = rd_kafka_AdminOptions_set_match_consumer_group_types(
563+
options, unknown_type, 1);
564+
TEST_ASSERT(error && rd_kafka_error_code(error), "%s",
565+
"Expected error on Unknown group type,"
566+
" got no error");
567+
rd_kafka_error_destroy(error);
568+
547569
exp_timeout = MY_SOCKET_TIMEOUT_MS * 2;
548570
TEST_CALL_ERR__(rd_kafka_AdminOptions_set_request_timeout(
549571
options, exp_timeout, errstr, sizeof(errstr)));

0 commit comments

Comments
 (0)