mirror of
https://gitee.com/milvus-io/milvus.git
synced 2026-01-03 17:31:58 +08:00
issue: #33285 - add adaptor to implement walimpls into wal interface. - implement timetick sorted and filtering scanner. - add test for wal. --------- Signed-off-by: chyezh <chyezh@outlook.com>
30 lines
737 B
Go
30 lines
737 B
Go
package utility
|
|
|
|
import (
|
|
"math/rand"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
"github.com/milvus-io/milvus/pkg/mocks/streaming/util/mock_message"
|
|
"github.com/milvus-io/milvus/pkg/streaming/util/message"
|
|
"github.com/milvus-io/milvus/pkg/util/typeutil"
|
|
)
|
|
|
|
func TestImmutableMessageHeap(t *testing.T) {
|
|
h := typeutil.NewHeap[message.ImmutableMessage](&immutableMessageHeap{})
|
|
timeticks := rand.Perm(25)
|
|
for _, timetick := range timeticks {
|
|
msg := mock_message.NewMockImmutableMessage(t)
|
|
msg.EXPECT().TimeTick().Return(uint64(timetick + 1))
|
|
h.Push(msg)
|
|
}
|
|
|
|
lastOneTimeTick := uint64(0)
|
|
for h.Len() != 0 {
|
|
msg := h.Pop()
|
|
assert.Greater(t, msg.TimeTick(), lastOneTimeTick)
|
|
lastOneTimeTick = msg.TimeTick()
|
|
}
|
|
}
|