github.com/hoveychen/kafka-go@v0.4.42/protocol/deletetopics/deletetopics_test.go (about) 1 package deletetopics_test 2 3 import ( 4 "testing" 5 6 "github.com/hoveychen/kafka-go/protocol/deletetopics" 7 "github.com/hoveychen/kafka-go/protocol/prototest" 8 ) 9 10 const ( 11 v0 = 0 12 v1 = 1 13 v3 = 3 14 ) 15 16 func TestDeleteTopicsRequest(t *testing.T) { 17 prototest.TestRequest(t, v0, &deletetopics.Request{ 18 TopicNames: []string{"foo", "bar"}, 19 TimeoutMs: 500, 20 }) 21 22 prototest.TestRequest(t, v1, &deletetopics.Request{ 23 TopicNames: []string{"foo", "bar"}, 24 TimeoutMs: 500, 25 }) 26 27 prototest.TestRequest(t, v3, &deletetopics.Request{ 28 TopicNames: []string{"foo", "bar"}, 29 TimeoutMs: 500, 30 }) 31 } 32 33 func TestDeleteTopicsResponse(t *testing.T) { 34 prototest.TestResponse(t, v0, &deletetopics.Response{ 35 Responses: []deletetopics.ResponseTopic{ 36 { 37 Name: "foo", 38 ErrorCode: 1, 39 }, 40 { 41 Name: "bar", 42 ErrorCode: 1, 43 }, 44 }, 45 }) 46 47 prototest.TestResponse(t, v1, &deletetopics.Response{ 48 ThrottleTimeMs: 500, 49 Responses: []deletetopics.ResponseTopic{ 50 { 51 Name: "foo", 52 ErrorCode: 1, 53 }, 54 { 55 Name: "bar", 56 ErrorCode: 1, 57 }, 58 }, 59 }) 60 61 prototest.TestResponse(t, v3, &deletetopics.Response{ 62 ThrottleTimeMs: 500, 63 Responses: []deletetopics.ResponseTopic{ 64 { 65 Name: "foo", 66 ErrorCode: 1, 67 }, 68 { 69 Name: "bar", 70 ErrorCode: 1, 71 }, 72 }, 73 }) 74 }