mirror of
https://gitee.com/milvus-io/milvus.git
synced 2025-12-06 17:18:35 +08:00
issue: #33285 - optimize the message package - add interceptor package to achieve append operation intercepting. - add timetick interceptor to attach timetick properties for message. - add timetick background task to send timetick message. Signed-off-by: chyezh <chyezh@outlook.com>
32 lines
824 B
Go
32 lines
824 B
Go
package options
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/milvus-io/milvus/pkg/mocks/streaming/util/mock_message"
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestDeliver(t *testing.T) {
|
|
policy := DeliverPolicyAll()
|
|
assert.Equal(t, DeliverPolicyTypeAll, policy.Policy())
|
|
assert.Panics(t, func() {
|
|
policy.MessageID()
|
|
})
|
|
|
|
policy = DeliverPolicyLatest()
|
|
assert.Equal(t, DeliverPolicyTypeLatest, policy.Policy())
|
|
assert.Panics(t, func() {
|
|
policy.MessageID()
|
|
})
|
|
|
|
messageID := mock_message.NewMockMessageID(t)
|
|
policy = DeliverPolicyStartFrom(messageID)
|
|
assert.Equal(t, DeliverPolicyTypeStartFrom, policy.Policy())
|
|
assert.Equal(t, messageID, policy.MessageID())
|
|
|
|
policy = DeliverPolicyStartAfter(messageID)
|
|
assert.Equal(t, DeliverPolicyTypeStartAfter, policy.Policy())
|
|
assert.Equal(t, messageID, policy.MessageID())
|
|
}
|