MCPcopy
hub / github.com/IBM/sarama / TestProduceResponseEncode

Function TestProduceResponseEncode

produce_response_test.go:172–196  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

170}
171
172func TestProduceResponseEncode(t *testing.T) {
173 response := ProduceResponse{}
174 response.Blocks = make(map[string]map[int32]*ProduceResponseBlock)
175 testEncodable(t, "empty", &response, produceResponseNoBlocksV0)
176
177 batchIndexErrMsg := "bad rec"
178 errMsg := "bad batch"
179 response.Blocks["foo"] = make(map[int32]*ProduceResponseBlock)
180 response.Blocks["foo"][1] = &ProduceResponseBlock{
181 Err: ErrInvalidMessage,
182 Offset: 255,
183 Timestamp: time.Unix(1, 0),
184 StartOffset: 50,
185 RecordErrors: []ProduceResponseRecordError{{
186 BatchIndex: 3,
187 BatchIndexErrorMessage: &batchIndexErrMsg,
188 }},
189 ErrorMessage: &errMsg,
190 }
191 response.ThrottleTime = 100 * time.Millisecond
192 for v, produceResponseManyBlocks := range produceResponseManyBlocksVersions {
193 response.Version = int16(v)
194 testEncodable(t, fmt.Sprintf("many blocks version %d", v), &response, produceResponseManyBlocks)
195 }
196}
197
198func TestProduceResponseEncodeInvalidTimestamp(t *testing.T) {
199 response := ProduceResponse{}

Callers

nothing calls this directly

Calls 1

testEncodableFunction · 0.85

Tested by

no test coverage detected