Skip to content

Commit 3f68080

Browse files
authored
feat: add ProtocolType to ListGroupsResponseGroup (#1403)
* feat: add ProtocolType to ListGroupsResponseGroup * Add test for expected ProtocolType in ListGroupsReponse
1 parent d851127 commit 3f68080

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

listgroups.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ type ListGroupsResponseGroup struct {
3131

3232
// Coordinator is the ID of the coordinator broker for the group.
3333
Coordinator int
34+
35+
// The group protocol type (eg "consumer", "connect")
36+
ProtocolType string
3437
}
3538

3639
func (c *Client) ListGroups(
@@ -48,8 +51,9 @@ func (c *Client) ListGroups(
4851

4952
for _, apiGroupInfo := range apiResp.Groups {
5053
resp.Groups = append(resp.Groups, ListGroupsResponseGroup{
51-
GroupID: apiGroupInfo.GroupID,
52-
Coordinator: int(apiGroupInfo.BrokerID),
54+
GroupID: apiGroupInfo.GroupID,
55+
Coordinator: int(apiGroupInfo.BrokerID),
56+
ProtocolType: apiGroupInfo.ProtocolType,
5357
})
5458
}
5559

listgroups_test.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,14 +96,21 @@ func TestClientListGroups(t *testing.T) {
9696
)
9797
}
9898
hasGroup := false
99+
hasProtocol := false
99100
for _, group := range resp.Groups {
100101
if group.GroupID == gid {
101102
hasGroup = true
103+
if group.ProtocolType == "consumer" {
104+
hasProtocol = true
105+
}
102106
break
103107
}
104108
}
105109

106110
if !hasGroup {
107111
t.Error("Group not found in list")
108112
}
113+
if !hasProtocol {
114+
t.Error("Group does not have expected protocol type")
115+
}
109116
}

0 commit comments

Comments
 (0)