github.com/hack0072008/kafka-go@v1.0.1/apiversions_test.go (about) 1 package kafka 2 3 import ( 4 "context" 5 "testing" 6 ) 7 8 func TestClientApiVersions(t *testing.T) { 9 ctx := context.Background() 10 11 client, shutdown := newLocalClient() 12 defer shutdown() 13 14 resp, err := client.ApiVersions(ctx, &ApiVersionsRequest{}) 15 if err != nil { 16 t.Fatal(err) 17 } 18 if resp.Error != nil { 19 t.Error( 20 "Unexpected error in response", 21 "expected", nil, 22 "got", resp.Error, 23 ) 24 } 25 26 if len(resp.ApiKeys) == 0 { 27 t.Error( 28 "Unexpected apiKeys length", 29 "expected greater than", 0, 30 "got", 0, 31 ) 32 } 33 }