Fix test issue in TestScheduleCompaction

It always reuse the same memory space. Each next iteration
will always overwrite previous data

Signed-off-by: Benjamin Wang <benjamin.ahrtr@gmail.com>
This commit is contained in:
Benjamin Wang
2024-01-19 15:29:37 +00:00
parent e5665a7ef2
commit 82562abc3c

View File

@@ -76,8 +76,8 @@ func TestScheduleCompaction(t *testing.T) {
tx := s.b.BatchTx()
tx.Lock()
ibytes := NewRevBytes()
for _, rev := range revs {
ibytes := NewRevBytes()
ibytes = RevToBytes(rev, ibytes)
tx.UnsafePut(schema.Key, ibytes, []byte("bar"))
}
@@ -90,6 +90,7 @@ func TestScheduleCompaction(t *testing.T) {
tx.Lock()
for _, rev := range tt.wrevs {
ibytes := NewRevBytes()
ibytes = RevToBytes(rev, ibytes)
keys, _ := tx.UnsafeRange(schema.Key, ibytes, nil, 0)
if len(keys) != 1 {