github.com/segmentio/kafka-go@v0.4.48-0.20240318174348-3f6244eb34fd/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  }