Skip to content

Commit

Permalink
Fix tests and change API to be similar to existing ones
Browse files Browse the repository at this point in the history
  • Loading branch information
milindl committed Jun 23, 2023
1 parent 3fec50a commit f497307
Show file tree
Hide file tree
Showing 10 changed files with 753 additions and 831 deletions.
8 changes: 4 additions & 4 deletions examples/describe_cluster.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,9 @@ print_cluster_info(const rd_kafka_DescribeCluster_result_t *clusterdesc) {
desc = rd_kafka_DescribeCluster_result_description(clusterdesc);

controller_id = rd_kafka_ClusterDescription_controller_id(desc);
node_cnt = rd_kafka_ClusterDescription_node_cnt(desc);
node_cnt = rd_kafka_ClusterDescription_node_count(desc);
cluster_authorized_operations_cnt =
rd_kafka_ClusterDescription_cluster_acl_operations_cnt(desc);
rd_kafka_ClusterDescription_cluster_authorized_operation_count(desc);
cluster_id = rd_kafka_ClusterDescription_cluster_id(desc);

printf(
Expand All @@ -159,15 +159,15 @@ print_cluster_info(const rd_kafka_DescribeCluster_result_t *clusterdesc) {
cluster_id, controller_id, cluster_authorized_operations_cnt);
for (j = 0; j < cluster_authorized_operations_cnt; j++) {
acl_operation =
rd_kafka_ClusterDescription_authorized_operation_idx(desc,
rd_kafka_ClusterDescription_authorized_operation(desc,
j);
printf("\t%s operation is allowed\n",
rd_kafka_AclOperation_name(acl_operation));
}

for (j = 0; j < node_cnt; j++) {
const rd_kafka_Node_t *node = NULL;
node = rd_kafka_ClusterDescription_node_idx(desc, j);
node = rd_kafka_ClusterDescription_node(desc, j);
printf("Node [id: %" PRId32
", host: %s"
", port: %" PRIu16 "]\n",
Expand Down
2 changes: 1 addition & 1 deletion examples/describe_consumer_groups.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ print_groups_info(const rd_kafka_DescribeConsumerGroups_result_t *grpdesc,
rd_kafka_consumer_group_state_t state =
rd_kafka_ConsumerGroupDescription_state(group);
authorized_operation_count =
rd_kafka_ConsumerGroupDescription_authorized_operations_count(
rd_kafka_ConsumerGroupDescription_authorized_operation_count(
group);
member_cnt =
rd_kafka_ConsumerGroupDescription_member_count(group);
Expand Down
20 changes: 10 additions & 10 deletions examples/describe_topics.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,10 @@ static int print_topics_info(const rd_kafka_DescribeTopics_result_t *topicdesc,
const char *topic_name =
rd_kafka_TopicDescription_topic_name(topic);
int topic_authorized_operations_cnt =
rd_kafka_TopicDescription_topic_authorized_operations_cnt(
rd_kafka_TopicDescription_topic_authorized_operation_count(
topic);
int partition_cnt =
rd_kafka_TopicDescription_topic_partition_cnt(topic);
rd_kafka_TopicDescription_topic_partition_count(topic);
error = rd_kafka_TopicDescription_error(topic);

if (rd_kafka_error_code(error)) {
Expand All @@ -179,13 +179,13 @@ static int print_topics_info(const rd_kafka_DescribeTopics_result_t *topicdesc,
topic_name, topic_authorized_operations_cnt);
for (j = 0; j < topic_authorized_operations_cnt; j++) {
acl_operation =
rd_kafka_TopicDescription_authorized_operation_idx(
rd_kafka_TopicDescription_authorized_operation(
topic, j);
printf("\t%s operation is allowed\n",
rd_kafka_AclOperation_name(acl_operation));
}

printf("partiton count is: %d\n", partition_cnt);
printf("partition count is: %d\n", partition_cnt);
for (j = 0; j < partition_cnt; j++) {
const rd_kafka_error_t *partition_error;
int leader, id, isr_cnt, replica_cnt, k;
Expand All @@ -201,13 +201,13 @@ static int print_topics_info(const rd_kafka_DescribeTopics_result_t *topicdesc,
continue;
}
printf("\tPartition at index %d succeeded\n", j);
id = rd_kafka_TopicDescription_partiton_id(topic, j);
id = rd_kafka_TopicDescription_partition_id(topic, j);
leader =
rd_kafka_TopicDescription_partiton_leader(topic, j);
isr_cnt = rd_kafka_TopicDescription_partiton_isr_cnt(
rd_kafka_TopicDescription_partition_leader(topic, j);
isr_cnt = rd_kafka_TopicDescription_partition_isr_count(
topic, j);
replica_cnt =
rd_kafka_TopicDescription_partiton_replica_cnt(
rd_kafka_TopicDescription_partition_replica_count(
topic, j);
printf("\tPartition has id: %d with leader: %d\n", id,
leader);
Expand All @@ -219,7 +219,7 @@ static int print_topics_info(const rd_kafka_DescribeTopics_result_t *topicdesc,
for (k = 0; k < isr_cnt; k++)
printf(
"%d ",
rd_kafka_TopicDescription_partiton_isrs_idx(
rd_kafka_TopicDescription_partition_isr(
topic, j, k));
printf("\n");
} else
Expand All @@ -231,7 +231,7 @@ static int print_topics_info(const rd_kafka_DescribeTopics_result_t *topicdesc,
for (k = 0; k < replica_cnt; k++)
printf(
"%d ",
rd_kafka_TopicDescription_partiton_replica_idx(
rd_kafka_TopicDescription_partition_replica(
topic, j, k));
printf("\n");
} else
Expand Down
Loading

0 comments on commit f497307

Please sign in to comment.