github.com/QuangHoangHao/kafka-go@v0.4.36/protocol/leavegroup/leavegroup_test.go (about)

     1  package leavegroup_test
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/QuangHoangHao/kafka-go/protocol/leavegroup"
     7  	"github.com/QuangHoangHao/kafka-go/protocol/prototest"
     8  )
     9  
    10  func TestLeaveGroupReq(t *testing.T) {
    11  	for _, version := range []int16{0, 1, 2} {
    12  		prototest.TestRequest(t, version, &leavegroup.Request{
    13  			GroupID:  "group-id",
    14  			MemberID: "member-id",
    15  		})
    16  	}
    17  
    18  	// Version 3 added
    19  	// Members
    20  	// removed
    21  	// MemberID
    22  	for _, version := range []int16{3, 4} {
    23  		prototest.TestRequest(t, version, &leavegroup.Request{
    24  			GroupID: "group-id",
    25  			Members: []leavegroup.RequestMember{
    26  				{
    27  					MemberID:        "member-id-1",
    28  					GroupInstanceID: "group-instance-id",
    29  				},
    30  			},
    31  		})
    32  	}
    33  }
    34  
    35  func TestLeaveGroupResp(t *testing.T) {
    36  	for _, version := range []int16{0} {
    37  		prototest.TestResponse(t, version, &leavegroup.Response{
    38  			ErrorCode: 10,
    39  		})
    40  	}
    41  
    42  	// Version 1 added
    43  	// ThrottleTimeMS
    44  	for _, version := range []int16{1, 2} {
    45  		prototest.TestResponse(t, version, &leavegroup.Response{
    46  			ErrorCode:      10,
    47  			ThrottleTimeMS: 100,
    48  		})
    49  	}
    50  
    51  	// Version 3 added
    52  	// Members
    53  	for _, version := range []int16{3, 4} {
    54  		prototest.TestResponse(t, version, &leavegroup.Response{
    55  			ErrorCode:      10,
    56  			ThrottleTimeMS: 100,
    57  			Members: []leavegroup.ResponseMember{
    58  				{
    59  					MemberID:        "member-id-1",
    60  					GroupInstanceID: "group-instance-id",
    61  					ErrorCode:       10,
    62  				},
    63  			},
    64  		})
    65  	}
    66  }