Skip to content
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

ListGroups API KIP 848 #1267

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

ListGroups API KIP 848 #1267

wants to merge 3 commits into from

Conversation

mahajanadhitya
Copy link
Contributor

No description provided.

@mahajanadhitya mahajanadhitya requested review from a team as code owners August 9, 2024 08:51
Copy link
Contributor

@milindl milindl left a 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

kafka/adminapi_test.go Outdated Show resolved Hide resolved

listres, err := a.ListConsumerGroups(
ctx, SetAdminRequestTimeout(time.Second),
SetAdminMatchConsumerGroupTypes([]ConsumerGroupType{classicGroupType, classicGroupType}))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
SetAdminMatchConsumerGroupTypes([]ConsumerGroupType{classicGroupType, classicGroupType}))
SetAdminMatchConsumerGroupTypes([]ConsumerGroupType{classicGroupType, classicGroupType}))

Why is the same group type included twice?

Copy link
Contributor Author

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.

Copy link
Contributor

@milindl milindl Aug 21, 2024

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/build_darwin_amd64.go Show resolved Hide resolved
kafka/integration_test.go Outdated Show resolved Hide resolved
kafka/integration_test.go Outdated Show resolved Hide resolved
Comment on lines 850 to 854
// 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())
Copy link
Contributor

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

Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor

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

* Upgrade Hamba to 2.24.0 (#2) (#1266)

* Upgrade Hamba to 2.24.0

Also enhance CSFLE examples; minor cleanup

* Fix imports

* Perform Avro schema resolution if necessary (#1) (#1265)

* Add missing API parts for schema registry (#1256)

* add some missing API parts

* fix context endpoint

---------

Co-authored-by: Alexander Hein <[email protected]>
Co-authored-by: Robert Yokota <[email protected]>

* Regenerate SR api docs (#4) (#1268)

* Fix some golint naming issues (#6) (#1272)

* Fix URL for DeksByVersion (#7) (#1273)

* Pinned cp-kafka version (#1270)

as 7.7.0 has bug https://issues.apache.org/jira/browse/KAFKA-16310 that makes LisOffsets test fail

* Single Commit

---------

Co-authored-by: Robert Yokota <[email protected]>
Co-authored-by: oleksandrkorzhenevskyi <[email protected]>
Co-authored-by: Alexander Hein <[email protected]>
Co-authored-by: Emanuele Sabellico <[email protected]>
ctx, cancel := context.WithTimeout(context.Background(), expDuration)
defer cancel()

listres, err := a.ListConsumerGroups(
Copy link
Contributor

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)
Copy link
Contributor

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}))
Copy link
Contributor

@milindl milindl Aug 21, 2024

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.

Comment on lines 850 to 854
// 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())
Copy link
Contributor

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

Copy link
Contributor

@milindl milindl left a 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

@mahajanadhitya
Copy link
Contributor Author

confluent-kafka-go KIP 848 ListGroups API

Branch Name

feature/ListGroupsAPI

Build

Install the corresponding Librdkafka and build with go build -tags dynamic ./...

Unit Tests

confluent-kafka-go/kafka/adminapi_test.go via testAdminAPIsListConsumerGroups
go test -tags dynamic -timeout 30s -run ^TestAdminAPIs

Cluster

Spawn the trivup cluster in librdkafka/tests
./interactive_broker_version.py 'trunk@f6c9feea76d01a46319b0ca602d70aa855057b07' --port 9092 --kraft --conf '{"conf":["unstable.api.versions.enable=true","group.coordinator.new.enable=true","group.protocol=classic,consumer"]}'

Example

confluent-kafka-go/examples/admin_list_consumer_groups/admin_list_consumer_groups.go
go run -tags dynamic admin_list_consumer_groups.go localhost:9092 [-states <state1> <state2> ...] [-types <type1> <type2> ...]

Integration Tests

Remember to set the Environment Variable TEST_CONSUMER_GROUP_PROTOCOL to consumer/classic
confluent-kafka-go/kafka/integration_test.go via TestAdminClient_ListConsumerGroups
go test -v -tags dynamic -run ^TestIntegration -testify.m TestAdminClient_ListConsumerGroups

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants