-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathlist_groups_test.go
24 lines (19 loc) · 975 Bytes
/
list_groups_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package client
import "testing"
var emptyListGroupsResponseBytes = []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
var errorListGroupsResponseBytes = []byte{0x00, 15, 0x00, 0x00, 0x00, 0x00}
var goodListGroupsResponseBytes = []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x03, 'f', 'o', 'o', 0x00, 0x08, 'c', 'o', 'n', 's', 'u', 'm', 'e', 'r'}
func TestListGroupsResponse(t *testing.T) {
emptyResponse := new(ListGroupsResponse)
decode(t, emptyResponse, emptyListGroupsResponseBytes)
assert(t, emptyResponse.Error, ErrNoError)
assert(t, len(emptyResponse.Groups), 0)
errorResponse := new(ListGroupsResponse)
decode(t, errorResponse, errorListGroupsResponseBytes)
assert(t, errorResponse.Error, ErrConsumerCoordinatorNotAvailableCode)
goodResponse := new(ListGroupsResponse)
decode(t, goodResponse, goodListGroupsResponseBytes)
assert(t, goodResponse.Error, ErrNoError)
assert(t, len(goodResponse.Groups), 1)
assert(t, goodResponse.Groups["foo"], "consumer")
}