Debian Codegraph @

protocol/describeclientquotas/describeclientquotas_test.go

raw
1 package describeclientquotas_test
2
3 import (
4 "testing"
5
6 "github.com/segmentio/kafka-go/protocol/describeclientquotas"
7 "github.com/segmentio/kafka-go/protocol/prototest"
8 )
9
10 const (
11 v0 = 0
12 v1 = 1
13 )
14
15 func TestDescribeClientQuotasRequest(t *testing.T) {
16 prototest.TestRequest(t, v0, &describeclientquotas.Request{
17 Strict: true,
18 Components: []describeclientquotas.Component{
19 {
20 EntityType: "client-id",
21 MatchType: 0,
22 Match: "my-client-id",
23 },
24 },
25 })
26
27 prototest.TestRequest(t, v1, &describeclientquotas.Request{
28 Strict: true,
29 Components: []describeclientquotas.Component{
30 {
31 EntityType: "client-id",
32 MatchType: 0,
33 Match: "my-client-id",
34 },
35 },
36 })
37 }
38
39 func TestDescribeClientQuotasResponse(t *testing.T) {
40 prototest.TestResponse(t, v0, &describeclientquotas.Response{
41 ThrottleTimeMs: 1,
42 ErrorCode: 1,
43 ErrorMessage: "foo",
44 Entries: []describeclientquotas.ResponseQuotas{
45 {
46 Entities: []describeclientquotas.Entity{
47 {
48 EntityType: "client-id",
49 EntityName: "my-client-id",
50 },
51 },
52 Values: []describeclientquotas.Value{
53 {
54 Key: "foo",
55 Value: 1.0,
56 },
57 },
58 },
59 },
60 })
61
62 prototest.TestResponse(t, v1, &describeclientquotas.Response{
63 ThrottleTimeMs: 1,
64 ErrorCode: 1,
65 ErrorMessage: "foo",
66 Entries: []describeclientquotas.ResponseQuotas{
67 {
68 Entities: []describeclientquotas.Entity{
69 {
70 EntityType: "client-id",
71 EntityName: "my-client-id",
72 },
73 },
74 Values: []describeclientquotas.Value{
75 {
76 Key: "foo",
77 Value: 1.0,
78 },
79 },
80 },
81 },
82 })
83 }