milvus/pkg/streaming/util/options/deliver_test.go
chyezh c725416288
enhance: move streaming proto into pkg (#35284)
issue: #33285

- move streaming related proto into pkg.
- add v2 message type and change flush message into v2 message.

Signed-off-by: chyezh <chyezh@outlook.com>
2024-08-07 10:34:16 +08:00

36 lines
1.0 KiB
Go

package options
import (
"testing"
"github.com/milvus-io/milvus/pkg/mocks/streaming/util/mock_message"
"github.com/milvus-io/milvus/pkg/streaming/proto/streamingpb"
)
func TestDeliverPolicy(t *testing.T) {
policy := DeliverPolicyAll()
_ = policy.GetPolicy().(*streamingpb.DeliverPolicy_All)
policy = DeliverPolicyLatest()
_ = policy.GetPolicy().(*streamingpb.DeliverPolicy_Latest)
messageID := mock_message.NewMockMessageID(t)
messageID.EXPECT().Marshal().Return("messageID")
policy = DeliverPolicyStartFrom(messageID)
_ = policy.GetPolicy().(*streamingpb.DeliverPolicy_StartFrom)
policy = DeliverPolicyStartAfter(messageID)
_ = policy.GetPolicy().(*streamingpb.DeliverPolicy_StartAfter)
}
func TestDeliverFilter(t *testing.T) {
filter := DeliverFilterTimeTickGT(1)
_ = filter.GetFilter().(*streamingpb.DeliverFilter_TimeTickGt)
filter = DeliverFilterTimeTickGTE(2)
_ = filter.GetFilter().(*streamingpb.DeliverFilter_TimeTickGte)
filter = DeliverFilterVChannel("vchannel")
_ = filter.GetFilter().(*streamingpb.DeliverFilter_Vchannel)
}