498b235461
Build and test / Build and test AMD64 Ubuntu 22.04 (push) Failing after 0s
Publish Builder / amazonlinux2023 (push) Failing after 1s
Build and test / UT for Go (push) Has been skipped
Publish KRTE Images / KRTE (push) Failing after 1s
Build and test / Integration Test (push) Has been skipped
Build and test / Upload Code Coverage (push) Has been skipped
Publish Builder / rockylinux9 (push) Failing after 1s
Publish Builder / ubuntu22.04 (push) Failing after 0s
Publish Builder / ubuntu24.04 (push) Failing after 0s
Publish Gpu Builder / publish-gpu-builder (push) Failing after 1s
Publish Test Images / PyTest (push) Failing after 0s
Build and test / UT for Cpp (push) Has been cancelled
30 lines
746 B
Go
30 lines
746 B
Go
package utility
|
|
|
|
import (
|
|
"math/rand"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
"github.com/milvus-io/milvus/pkg/v3/mocks/streaming/util/mock_message"
|
|
"github.com/milvus-io/milvus/pkg/v3/streaming/util/message"
|
|
"github.com/milvus-io/milvus/pkg/v3/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()
|
|
}
|
|
}
|