-
Notifications
You must be signed in to change notification settings - Fork 659
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
[KIP-848 EA] Admin API for listing consumer groups now has #1267
Conversation
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.
Thanks for the changes! Looks mostly okay.
Remember to add it to CHANGELOG.md also
|
||
listres, err := a.ListConsumerGroups( | ||
ctx, SetAdminRequestTimeout(time.Second), | ||
SetAdminMatchConsumerGroupTypes([]ConsumerGroupType{classicGroupType, classicGroupType})) |
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.
SetAdminMatchConsumerGroupTypes([]ConsumerGroupType{classicGroupType, classicGroupType})) | |
SetAdminMatchConsumerGroupTypes([]ConsumerGroupType{classicGroupType, classicGroupType})) |
Why is the same group type included twice?
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.
It is to test the INVALID_ARGS error code with duplicate group types.
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.
But your test is not checking for invalid args error code below, so change that. You're checking for deadline exceeded still.
kafka/integration_test.go
Outdated
// Generating a new topic/groupID to ensure a fresh group/topic is created. | ||
rand.Seed(time.Now().Unix()) | ||
groupID := fmt.Sprintf("%s-%d", testconf.GroupID, rand.Int()) | ||
topic := fmt.Sprintf("%s-%d", testconf.TopicName, rand.Int()) | ||
nonExistentGroupID := fmt.Sprintf("%s-nonexistent-%d", testconf.GroupID, rand.Int()) |
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.
Move above the "if" block, and remove from below too, so they're not duplicated
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.
Same for creation of adminclient, topic creation, etc.
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.
Actually this is done voluntarily because currently in semaphore we run the whole tests with broker version < 3.8.0.0 and then when we run with higher broker version on semaphore to test the consumer group protocol we only check the case of consumer group that is why we return at the end.
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.
Okay, so since there is nothing common between the tests, why don't you split them? I don't see why we should have an entirely different test in an if block if there's any shared code between them, it just makes it harder to read.
TestAdminClient_ListAndDescribeConsumerGroupsClassic and TestAdminClient_ListConsumerGroupsConsumer
kafka/adminapi_test.go
Outdated
ctx, cancel := context.WithTimeout(context.Background(), expDuration) | ||
defer cancel() | ||
|
||
listres, err := a.ListConsumerGroups( |
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.
gofmt needs to be run
@@ -464,7 +467,10 @@ func testAdminAPIsListConsumerGroups( | |||
t.Fatalf("Expected ConsumerGroupTypeFromString to work for Unknown type") | |||
} | |||
|
|||
listres, err := a.ListConsumerGroups( | |||
ctx, cancel := context.WithTimeout(context.Background(), expDuration) |
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.
I think this code doesn't run. Are the tests running when you are dynamically linking librdkafka? This is a compilation error because := and not =
|
||
listres, err := a.ListConsumerGroups( | ||
ctx, SetAdminRequestTimeout(time.Second), | ||
SetAdminMatchConsumerGroupTypes([]ConsumerGroupType{classicGroupType, classicGroupType})) |
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.
But your test is not checking for invalid args error code below, so change that. You're checking for deadline exceeded still.
kafka/integration_test.go
Outdated
// Generating a new topic/groupID to ensure a fresh group/topic is created. | ||
rand.Seed(time.Now().Unix()) | ||
groupID := fmt.Sprintf("%s-%d", testconf.GroupID, rand.Int()) | ||
topic := fmt.Sprintf("%s-%d", testconf.TopicName, rand.Int()) | ||
nonExistentGroupID := fmt.Sprintf("%s-nonexistent-%d", testconf.GroupID, rand.Int()) |
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.
Okay, so since there is nothing common between the tests, why don't you split them? I don't see why we should have an entirely different test in an if block if there's any shared code between them, it just makes it harder to read.
TestAdminClient_ListAndDescribeConsumerGroupsClassic and TestAdminClient_ListConsumerGroupsConsumer
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.
Some more comments, please run the tests
confluent-kafka-go KIP 848 ListGroups APIBranch Name
BuildInstall the corresponding Librdkafka and build with Unit Tests
ClusterSpawn the trivup cluster in Example
Integration TestsRemember to set the Environment Variable |
db9f908
to
1734ea3
Compare
🎉 All Contributor License Agreements have been signed. Ready to merge. |
Converting to draft until we merge v2.6.0-RC2 |
b7f17bf
to
3a31587
Compare
and tests Co-authored-by: mahajanadhitya <[email protected]>
3a31587
to
69b9e96
Compare
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.
All doubts cleared over a call.
LGTM!.
an optional filter to return only groups of given types