From 12e05077db93bb54a99c18486f4212b85bffd3a6 Mon Sep 17 00:00:00 2001 From: Dominic Evans Date: Wed, 2 Aug 2023 22:01:16 +0100 Subject: [PATCH] fix: RemoveMemberFromConsumerGroup needs >= 2.4.0 Signed-off-by: Dominic Evans --- admin.go | 4 ++++ functional_consumer_staticmembership_test.go | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/admin.go b/admin.go index 31b903fe6b..ef5f481a47 100644 --- a/admin.go +++ b/admin.go @@ -1212,6 +1212,10 @@ func (ca *clusterAdmin) AlterClientQuotas(entity []QuotaEntityComponent, op Clie } func (ca *clusterAdmin) RemoveMemberFromConsumerGroup(groupId string, groupInstanceIds []string) (*LeaveGroupResponse, error) { + if !ca.conf.Version.IsAtLeast(V2_4_0_0) { + return nil, ConfigurationError("Removing members from a consumer group headers requires Kafka version of at least v2.4.0") + } + controller, err := ca.client.Coordinator(groupId) if err != nil { return nil, err diff --git a/functional_consumer_staticmembership_test.go b/functional_consumer_staticmembership_test.go index 946169b109..6b8f3245d0 100644 --- a/functional_consumer_staticmembership_test.go +++ b/functional_consumer_staticmembership_test.go @@ -67,7 +67,7 @@ func TestFuncConsumerGroupStaticMembership_Basic(t *testing.T) { } func TestFuncConsumerGroupStaticMembership_RejoinAndLeave(t *testing.T) { - checkKafkaVersion(t, "2.3.0") + checkKafkaVersion(t, "2.4.0") setupFunctionalTest(t) defer teardownFunctionalTest(t) groupID := testFuncConsumerGroupID(t) @@ -76,7 +76,7 @@ func TestFuncConsumerGroupStaticMembership_RejoinAndLeave(t *testing.T) { config1 := NewTestConfig() config1.ClientID = "M1" - config1.Version = V2_3_0_0 + config1.Version = V2_4_0_0 config1.Consumer.Offsets.Initial = OffsetNewest config1.Consumer.Group.InstanceId = "Instance1" m1 := runTestFuncConsumerGroupMemberWithConfig(t, config1, groupID, math.MaxInt32, nil, "test.4") @@ -84,7 +84,7 @@ func TestFuncConsumerGroupStaticMembership_RejoinAndLeave(t *testing.T) { config2 := NewTestConfig() config2.ClientID = "M2" - config2.Version = V2_3_0_0 + config2.Version = V2_4_0_0 config2.Consumer.Offsets.Initial = OffsetNewest config2.Consumer.Group.InstanceId = "Instance2" m2 := runTestFuncConsumerGroupMemberWithConfig(t, config2, groupID, math.MaxInt32, nil, "test.4")