fix(bstream/writeByte): ensure it appends only one byte (#14854)
fix(bstream/writeByte): ensure it appends only one byte Signed-off-by: Antoine Pultier <antoine.pultier@sintef.no>
This commit is contained in:
parent
d0d57ff642
commit
d90d0976b5
|
@ -334,7 +334,7 @@ func TestStreamReadEndpoint(t *testing.T) {
|
|||
Type: prompb.Chunk_XOR,
|
||||
MinTimeMs: 7200000,
|
||||
MaxTimeMs: 7200000,
|
||||
Data: []byte("\000\001\200\364\356\006@\307p\000\000\000\000\000\000"),
|
||||
Data: []byte("\000\001\200\364\356\006@\307p\000\000\000\000\000"),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -381,7 +381,7 @@ func TestStreamReadEndpoint(t *testing.T) {
|
|||
Type: prompb.Chunk_XOR,
|
||||
MinTimeMs: 14400000,
|
||||
MaxTimeMs: 14400000,
|
||||
Data: []byte("\000\001\200\350\335\r@\327p\000\000\000\000\000\000"),
|
||||
Data: []byte("\000\001\200\350\335\r@\327p\000\000\000\000\000"),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
@ -152,7 +152,7 @@ func TestCorruptedChunk(t *testing.T) {
|
|||
require.NoError(t, err)
|
||||
require.NoError(t, f.Truncate(fi.Size()-1))
|
||||
},
|
||||
iterErr: errors.New("cannot populate chunk 8 from block 00000000000000000000000000: segment doesn't include enough bytes to read the chunk - required:26, available:25"),
|
||||
iterErr: errors.New("cannot populate chunk 8 from block 00000000000000000000000000: segment doesn't include enough bytes to read the chunk - required:25, available:24"),
|
||||
},
|
||||
{
|
||||
name: "checksum mismatch",
|
||||
|
@ -170,7 +170,7 @@ func TestCorruptedChunk(t *testing.T) {
|
|||
require.NoError(t, err)
|
||||
require.Equal(t, 1, n)
|
||||
},
|
||||
iterErr: errors.New("cannot populate chunk 8 from block 00000000000000000000000000: checksum mismatch expected:cfc0526c, actual:34815eae"),
|
||||
iterErr: errors.New("cannot populate chunk 8 from block 00000000000000000000000000: checksum mismatch expected:231bddcf, actual:d85ad10d"),
|
||||
},
|
||||
} {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
|
|
|
@ -86,8 +86,8 @@ func (b *bstream) writeBit(bit bit) {
|
|||
|
||||
func (b *bstream) writeByte(byt byte) {
|
||||
if b.count == 0 {
|
||||
b.stream = append(b.stream, 0)
|
||||
b.count = 8
|
||||
b.stream = append(b.stream, byt)
|
||||
return
|
||||
}
|
||||
|
||||
i := len(b.stream) - 1
|
||||
|
|
Loading…
Reference in New Issue