github.com/segmentio/kafka-go@v0.4.48-0.20240318174348-3f6244eb34fd/protocol/alterpartitionreassignments/alterpartitionreassignments_test.go (about)

     1  package alterpartitionreassignments_test
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/segmentio/kafka-go/protocol/alterpartitionreassignments"
     7  	"github.com/segmentio/kafka-go/protocol/prototest"
     8  )
     9  
    10  const (
    11  	v0 = 0
    12  )
    13  
    14  func TestAlterPartitionReassignmentsRequest(t *testing.T) {
    15  	prototest.TestRequest(t, v0, &alterpartitionreassignments.Request{
    16  		TimeoutMs: 1,
    17  		Topics: []alterpartitionreassignments.RequestTopic{
    18  			{
    19  				Name: "topic-1",
    20  				Partitions: []alterpartitionreassignments.RequestPartition{
    21  					{
    22  						PartitionIndex: 1,
    23  						Replicas:       []int32{1, 2, 3},
    24  					},
    25  					{
    26  						PartitionIndex: 2,
    27  					},
    28  				},
    29  			},
    30  		},
    31  	})
    32  }
    33  
    34  func TestAlterPartitionReassignmentsResponse(t *testing.T) {
    35  	prototest.TestResponse(t, v0, &alterpartitionreassignments.Response{
    36  		ErrorCode:      1,
    37  		ErrorMessage:   "error",
    38  		ThrottleTimeMs: 1,
    39  		Results: []alterpartitionreassignments.ResponseResult{
    40  			{
    41  				Name: "topic-1",
    42  				Partitions: []alterpartitionreassignments.ResponsePartition{
    43  					{
    44  						PartitionIndex: 1,
    45  						ErrorMessage:   "error",
    46  						ErrorCode:      1,
    47  					},
    48  					{
    49  						PartitionIndex: 2,
    50  					},
    51  				},
    52  			},
    53  		},
    54  	})
    55  }