milvus/internal/log/meta_logger_test.go
Jiquan Long a5e2d6b6fb
Refactor RootCoord (#18930)
Signed-off-by: longjiquan <jiquan.long@zilliz.com>
Co-authored-by: xaxys <tpnnghd@163.com>

Signed-off-by: longjiquan <jiquan.long@zilliz.com>
Co-authored-by: xaxys <tpnnghd@163.com>
2022-09-05 13:29:11 +08:00

51 lines
1.5 KiB
Go

package log
import (
"testing"
"github.com/milvus-io/milvus/internal/metastore/model"
)
func TestMetaLogger(t *testing.T) {
ts := newTestLogSpy(t)
conf := &Config{Level: "debug", DisableTimestamp: true, DisableCaller: true}
logger, _, _ := InitTestLogger(ts, conf)
replaceLeveledLoggers(logger)
NewMetaLogger().WithCollectionID(0).
WithCollectionMeta(&model.Collection{}).
WithIndexMeta(&model.Index{}).
WithCollectionName("coll").
WithPartitionID(0).
WithPartitionName("part").
WithFieldID(0).
WithFieldName("field").
WithIndexID(0).
WithIndexName("idx").
WithBuildID(0).
WithBuildIDS([]int64{0, 0}).
WithSegmentID(0).
WithIndexFiles([]string{"idx", "idx"}).
WithIndexVersion(0).
WithTSO(0).
WithAlias("alias").
WithOperation(DropCollection).Info()
ts.assertMessagesContains("CollectionID=0")
ts.assertMessagesContains("CollectionName=coll")
ts.assertMessagesContains("PartitionID=0")
ts.assertMessagesContains("PartitionName=part")
ts.assertMessagesContains("FieldID=0")
ts.assertMessagesContains("FieldName=field")
ts.assertMessagesContains("IndexID=0")
ts.assertMessagesContains("IndexName=idx")
ts.assertMessagesContains("BuildID=0")
ts.assertMessagesContains("\"[0,0]\"")
ts.assertMessagesContains("SegmentID=0")
ts.assertMessagesContains("IndexFiles=\"[idx,idx]\"")
ts.assertMessagesContains("IndexVersion=0")
ts.assertMessagesContains("TSO=0")
ts.assertMessagesContains("Alias=alias")
ts.assertMessagesContains("Operation=1")
}