Skip to content

Commit d0f918b

Browse files
authored
Merge pull request #642 from thalesmg/20250725-fix-list-groups
fix: `ListGroups` request V3
2 parents f4e4180 + 8bee59f commit d0f918b

5 files changed

Lines changed: 20 additions & 4 deletions

File tree

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
branches:
88
- master
99
env:
10-
OTP_VERSION: "27"
10+
OTP_VERSION: "27.2"
1111
REBAR_VERSION: "3.24.0"
1212

1313
jobs:
@@ -18,7 +18,7 @@ jobs:
1818
- name: Checkout
1919
uses: actions/checkout@v2
2020
- name: OTP
21-
uses: erlef/setup-beam@v1
21+
uses: erlef/setup-beam@v1.20.4
2222
with:
2323
version-type: strict
2424
otp-version: ${{ env.OTP_VERSION }}

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Changelog
22

3+
- 4.4.4
4+
- Fixed `ListGroups` API request for Kafka Protocol API version 3.
5+
36
- 4.4.3
47
- Modify`brod_client:get_metadata` and `brod_client:get_metadata_safe` function for support multiple topics.
58

src/brod_kafka_request.erl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,12 @@ offset_fetch(Connection, GroupId, Topics0) ->
134134
-spec list_groups(conn()) -> kpro:req().
135135
list_groups(Connection) ->
136136
Vsn = pick_version(list_groups, Connection),
137-
kpro:make_request(list_groups, Vsn, []).
137+
case Vsn >= 3 of
138+
true ->
139+
kpro:make_request(list_groups, Vsn, #{tagged_fields => []});
140+
false ->
141+
kpro:make_request(list_groups, Vsn, [])
142+
end.
138143

139144
%% @doc Make a `join_group' request.
140145
-spec join_group(conn(), kpro:struct()) -> kpro:req().

test/brod_SUITE.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ suite() -> [{timetrap, {minutes, 5}}].
4343
init_per_suite(Config) ->
4444
case kafka_test_helper:kafka_version() of
4545
{0, 9} ->
46-
{skip, "no_topic_manaegment_apis"};
46+
{skip, "no_topic_management_apis"};
4747
_ ->
4848
{ok, _} = application:ensure_all_started(brod),
4949
Config

test/brod_consumer_SUITE.erl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
, t_subscribe_with_unknown_offset/1
4747
, t_offset_reset_policy/1
4848
, t_stop_kill/1
49+
, t_smoke_list_groups/1
4950
]).
5051

5152

@@ -884,6 +885,13 @@ t_stop_kill(Config) when is_list(Config) ->
884885
?WAIT_ONLY({'DOWN', Mref, process, Pid, killed}, ok),
885886
ok = brod_consumer:stop_maybe_kill(Pid, 100).
886887

888+
%% Smoke test for `ListGroups` API.
889+
t_smoke_list_groups(Config) when is_list(Config) ->
890+
[Endpoint] = ?HOSTS,
891+
ConnOpts = kafka_test_helper:client_config(),
892+
?assertMatch({ok, Groups} when is_list(Groups), brod:list_groups(Endpoint, ConnOpts)),
893+
ok.
894+
887895
%%%_* Help functions ===========================================================
888896

889897
%% os:timestamp should be unique enough for testing

0 commit comments

Comments
 (0)