| 1 |
|
| 2 |
|
| 3 |
package sarama |
| 4 |
|
| 5 |
import "testing" |
| 6 |
|
| 7 |
var ( |
| 8 |
alterPartitionReassignmentsResponseNoError = []byte{ |
| 9 |
0, 0, 39, 16, |
| 10 |
0, 0, |
| 11 |
0, |
| 12 |
1, |
| 13 |
0, |
| 14 |
} |
| 15 |
|
| 16 |
alterPartitionReassignmentsResponseWithError = []byte{ |
| 17 |
0, 0, 39, 16, |
| 18 |
0, 12, |
| 19 |
6, 101, 114, 114, 111, 114, |
| 20 |
2, |
| 21 |
6, 116, 111, 112, 105, 99, |
| 22 |
2, |
| 23 |
0, 0, 0, 1, |
| 24 |
0, 3, |
| 25 |
7, 101, 114, 114, 111, 114, 50, |
| 26 |
0, 0, 0, |
| 27 |
} |
| 28 |
) |
| 29 |
|
| 30 |
func TestAlterPartitionReassignmentResponse(t *testing.T) { |
| 31 |
var response *AlterPartitionReassignmentsResponse = &AlterPartitionReassignmentsResponse{ |
| 32 |
ThrottleTimeMs: int32(10000), |
| 33 |
Version: int16(0), |
| 34 |
} |
| 35 |
|
| 36 |
testResponse(t, "no error", response, alterPartitionReassignmentsResponseNoError) |
| 37 |
|
| 38 |
errorMessage := "error" |
| 39 |
partitionError := "error2" |
| 40 |
response.ErrorCode = 12 |
| 41 |
response.ErrorMessage = &errorMessage |
| 42 |
response.AddError("topic", 1, 3, &partitionError) |
| 43 |
|
| 44 |
testResponse(t, "with error", response, alterPartitionReassignmentsResponseWithError) |
| 45 |
} |