|
|
@@ -116,11 +116,12 @@ var recordBatchTestCases = []struct {
|
|
|
{
|
|
|
name: "gzipped record",
|
|
|
batch: RecordBatch{
|
|
|
- Version: 2,
|
|
|
- Codec: CompressionGZIP,
|
|
|
- FirstTimestamp: time.Unix(1479847795, 0),
|
|
|
- MaxTimestamp: time.Unix(0, 0),
|
|
|
- LastOffsetDelta: 0,
|
|
|
+ Version: 2,
|
|
|
+ Codec: CompressionGZIP,
|
|
|
+ CompressionLevel: CompressionLevelDefault,
|
|
|
+ FirstTimestamp: time.Unix(1479847795, 0),
|
|
|
+ MaxTimestamp: time.Unix(0, 0),
|
|
|
+ LastOffsetDelta: 0,
|
|
|
Records: []*Record{{
|
|
|
TimestampDelta: 5 * time.Millisecond,
|
|
|
Key: []byte{1, 2, 3, 4},
|
|
|
@@ -281,6 +282,9 @@ func TestRecordBatchDecoding(t *testing.T) {
|
|
|
for _, r := range tc.batch.Records {
|
|
|
r.length = varintLengthField{}
|
|
|
}
|
|
|
+ // The compression level is not restored on decoding. It is not needed
|
|
|
+ // anyway. We only set it here to ensure that comparision succeeds.
|
|
|
+ batch.CompressionLevel = tc.batch.CompressionLevel
|
|
|
if !reflect.DeepEqual(batch, tc.batch) {
|
|
|
t.Errorf(spew.Sprintf("invalid decode of %s\ngot %+v\nwanted %+v", tc.name, batch, tc.batch))
|
|
|
}
|