mirror of https://github.com/milvus-io/milvus.git
Remove fmt.Print from internal package (#22722)
Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>pull/22763/head
parent
6959332b08
commit
732986aa04
|
@ -17,7 +17,7 @@
|
|||
package common
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/cockroachdb/errors"
|
||||
|
@ -28,7 +28,7 @@ import (
|
|||
)
|
||||
|
||||
func TestIgnorableError(t *testing.T) {
|
||||
err := fmt.Errorf("test err")
|
||||
err := errors.New("test err")
|
||||
iErr := NewIgnorableError(err)
|
||||
assert.True(t, IsIgnorableError(iErr))
|
||||
assert.False(t, IsIgnorableError(err))
|
||||
|
@ -42,7 +42,8 @@ func TestNotExistError(t *testing.T) {
|
|||
|
||||
func TestStatusError_Error(t *testing.T) {
|
||||
err := NewCollectionNotExistError("collection not exist")
|
||||
fmt.Println("test status error: ", err.Error())
|
||||
assert.True(t, IsStatusError(err))
|
||||
assert.True(t, strings.Contains(err.Error(), "collection not exist"))
|
||||
}
|
||||
|
||||
func TestIsStatusError(t *testing.T) {
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
package datacoord
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"sort"
|
||||
"testing"
|
||||
"time"
|
||||
|
@ -39,7 +38,6 @@ type spyCompactionHandler struct {
|
|||
|
||||
// execCompactionPlan start to execute plan and return immediately
|
||||
func (h *spyCompactionHandler) execCompactionPlan(signal *compactionSignal, plan *datapb.CompactionPlan) error {
|
||||
fmt.Println("plan ", plan.SegmentBinlogs)
|
||||
h.spyChan <- plan
|
||||
return nil
|
||||
}
|
||||
|
@ -1492,7 +1490,6 @@ func Test_compactionTrigger_noplan_random_size(t *testing.T) {
|
|||
for _, log := range plan.SegmentBinlogs {
|
||||
size += log.FieldBinlogs[0].GetBinlogs()[0].LogSize
|
||||
}
|
||||
fmt.Println("target ", len(plan.SegmentBinlogs))
|
||||
}
|
||||
assert.Equal(t, 4, len(plans))
|
||||
// plan 1: 250 + 20 * 10 + 3 * 20
|
||||
|
|
|
@ -18,7 +18,6 @@ package datacoord
|
|||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/cockroachdb/errors"
|
||||
|
@ -451,8 +450,6 @@ func TestUpdateFlushSegmentsInfo(t *testing.T) {
|
|||
Deltalogs: []*datapb.FieldBinlog{{Binlogs: []*datapb.Binlog{{EntriesNum: 1, TimestampFrom: 100, TimestampTo: 200, LogSize: 1000}}}},
|
||||
}}
|
||||
|
||||
fmt.Println(updated)
|
||||
fmt.Println(expected)
|
||||
assert.Equal(t, updated.StartPosition, expected.StartPosition)
|
||||
assert.Equal(t, updated.DmlPosition, expected.DmlPosition)
|
||||
assert.Equal(t, updated.DmlPosition, expected.DmlPosition)
|
||||
|
|
|
@ -19,7 +19,6 @@ package datanode
|
|||
import (
|
||||
"container/heap"
|
||||
"context"
|
||||
"fmt"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
|
@ -233,7 +232,7 @@ func TestFlowGraphDeleteNode_Operate(t *testing.T) {
|
|||
assert.Nil(t, err)
|
||||
|
||||
segID2Pks, _ := dn.filterSegmentByPK(0, int64Pks, tss)
|
||||
fmt.Println(segID2Pks)
|
||||
t.Log(segID2Pks)
|
||||
expected := map[int64][]primaryKey{
|
||||
segIDs[0]: int64Pks[0:3],
|
||||
segIDs[1]: int64Pks[0:3],
|
||||
|
|
|
@ -21,9 +21,11 @@ import (
|
|||
"fmt"
|
||||
"reflect"
|
||||
|
||||
"github.com/milvus-io/milvus/internal/log"
|
||||
"github.com/milvus-io/milvus/internal/types"
|
||||
"github.com/milvus-io/milvus/internal/util/commonpbutil"
|
||||
"github.com/milvus-io/milvus/internal/util/paramtable"
|
||||
"go.uber.org/zap"
|
||||
|
||||
"github.com/milvus-io/milvus-proto/go-api/commonpb"
|
||||
"github.com/milvus-io/milvus-proto/go-api/milvuspb"
|
||||
|
@ -92,6 +94,6 @@ func printCollectionStruct(obj *etcdpb.CollectionMeta) {
|
|||
if typeOfS.Field(i).Name == "GrpcMarshalString" {
|
||||
continue
|
||||
}
|
||||
fmt.Printf("Field: %s\tValue: %v\n", typeOfS.Field(i).Name, v.Field(i).Interface())
|
||||
log.Info("Collection field", zap.String("field", typeOfS.Field(i).Name), zap.Any("value", v.Field(i).Interface()))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -450,6 +450,7 @@ func (s *Server) init() error {
|
|||
return err
|
||||
}
|
||||
log.Debug("init Proxy done")
|
||||
// nolint
|
||||
// Intentionally print to stdout, which is usually a sign that Milvus is ready to serve.
|
||||
fmt.Println("---Milvus Proxy successfully initialized and ready to serve!---")
|
||||
|
||||
|
|
|
@ -34,7 +34,6 @@ import (
|
|||
"bufio"
|
||||
"bytes"
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
@ -57,7 +56,7 @@ func TestExport(t *testing.T) {
|
|||
Error("Testing")
|
||||
Sync()
|
||||
ts.assertMessagesContains("log_test.go:")
|
||||
logPanic()
|
||||
logPanic(t)
|
||||
|
||||
ts = newTestLogSpy(t)
|
||||
logger, _, _ = InitTestLogger(ts, conf)
|
||||
|
@ -71,10 +70,10 @@ func TestExport(t *testing.T) {
|
|||
ts.assertMessagesContains(`age=42`)
|
||||
}
|
||||
|
||||
func logPanic() {
|
||||
func logPanic(t *testing.T) {
|
||||
defer func() {
|
||||
if err := recover(); err != nil {
|
||||
fmt.Println("logPanic recover")
|
||||
t.Log("logPanic recover")
|
||||
}
|
||||
}()
|
||||
Panic("Testing")
|
||||
|
@ -264,7 +263,7 @@ func TestStdAndFileLogger(t *testing.T) {
|
|||
RootPath: tmpDir,
|
||||
Filename: "TestStdAndFileLogger",
|
||||
}
|
||||
fmt.Println(tmpDir)
|
||||
t.Log(tmpDir)
|
||||
conf := &Config{Level: "debug", Stdout: true, File: fileConf}
|
||||
|
||||
logger, _, err := InitLogger(conf)
|
||||
|
|
|
@ -1049,7 +1049,7 @@ func TestRocksmq_SeekWithNoConsumerError(t *testing.T) {
|
|||
|
||||
rmq.CreateTopic("test")
|
||||
err = rmq.Seek("test", "", 0)
|
||||
fmt.Println(err)
|
||||
t.Log(err)
|
||||
assert.Error(t, err)
|
||||
assert.Error(t, rmq.ForceSeek("test", "", 0))
|
||||
}
|
||||
|
|
|
@ -18,7 +18,6 @@ package msgstream
|
|||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
"sync"
|
||||
"testing"
|
||||
|
@ -424,7 +423,7 @@ func TestStream_KafkaTtMsgStream_DataNodeTimetickMsgstream(t *testing.T) {
|
|||
assert.NotNil(t, msgPack)
|
||||
|
||||
if len(msgPack.Msgs) > 0 {
|
||||
fmt.Println("msg===:", msgPack.Msgs[0])
|
||||
t.Log("msg===:", msgPack.Msgs[0])
|
||||
wg.Done()
|
||||
return
|
||||
}
|
||||
|
|
|
@ -61,6 +61,7 @@ func TestMain(m *testing.M) {
|
|||
mockKafkaCluster, err := kafka.NewMockCluster(1)
|
||||
defer mockKafkaCluster.Close()
|
||||
if err != nil {
|
||||
// nolint
|
||||
fmt.Printf("Failed to create MockCluster: %s\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ func TestMain(m *testing.M) {
|
|||
mockCluster, err := kafka.NewMockCluster(1)
|
||||
defer mockCluster.Close()
|
||||
if err != nil {
|
||||
// nolint
|
||||
fmt.Printf("Failed to create MockCluster: %s\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
|
|
@ -191,7 +191,7 @@ func TestPulsarClientCloseUnsubscribeError(t *testing.T) {
|
|||
|
||||
err = consumer.Unsubscribe()
|
||||
assert.True(t, strings.Contains(err.Error(), "Consumer not found"))
|
||||
fmt.Println(err)
|
||||
t.Log(err)
|
||||
}
|
||||
|
||||
func TestPulsarClientUnsubscribeTwice(t *testing.T) {
|
||||
|
@ -216,5 +216,5 @@ func TestPulsarClientUnsubscribeTwice(t *testing.T) {
|
|||
assert.NoError(t, err)
|
||||
err = consumer.Unsubscribe()
|
||||
assert.True(t, strings.Contains(err.Error(), "Consumer not found"))
|
||||
fmt.Println(err)
|
||||
t.Log(err)
|
||||
}
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
package msgstream
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/golang/protobuf/proto"
|
||||
|
@ -27,18 +26,6 @@ import (
|
|||
"github.com/milvus-io/milvus-proto/go-api/msgpb"
|
||||
)
|
||||
|
||||
func newInsertMsgUnmarshal(input []byte) (TsMsg, error) {
|
||||
insertRequest := msgpb.InsertRequest{}
|
||||
err := proto.Unmarshal(input, &insertRequest)
|
||||
insertMsg := &InsertMsg{InsertRequest: insertRequest}
|
||||
fmt.Println("use func newInsertMsgUnmarshal unmarshal")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return insertMsg, nil
|
||||
}
|
||||
|
||||
func Test_ProtoUnmarshalDispatcher(t *testing.T) {
|
||||
msgPack := MsgPack{}
|
||||
insertMsg := &InsertMsg{
|
||||
|
@ -68,9 +55,6 @@ func Test_ProtoUnmarshalDispatcher(t *testing.T) {
|
|||
factory := &ProtoUDFactory{}
|
||||
unmarshalDispatcher := factory.NewUnmarshalDispatcher()
|
||||
|
||||
// FIXME(wxyu): Maybe we dont need this interface
|
||||
//unmarshalDispatcher.AddMsgTemplate(commonpb.MsgType_kInsert, newInsertMsgUnmarshal)
|
||||
|
||||
for _, v := range msgPack.Msgs {
|
||||
headerMsg := commonpb.MsgHeader{}
|
||||
payload, err := v.Marshal(v)
|
||||
|
@ -81,6 +65,6 @@ func Test_ProtoUnmarshalDispatcher(t *testing.T) {
|
|||
assert.Nil(t, err)
|
||||
msg, err := unmarshalDispatcher.Unmarshal(p, headerMsg.Base.MsgType)
|
||||
assert.Nil(t, err)
|
||||
fmt.Println("msg type: ", msg.Type(), ", msg value: ", msg, "msg tag: ")
|
||||
t.Log("msg type: ", msg.Type(), ", msg value: ", msg, "msg tag: ")
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,9 +2,10 @@ package planparserv2
|
|||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
|
||||
"github.com/milvus-io/milvus/internal/log"
|
||||
"github.com/milvus-io/milvus/internal/proto/planpb"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
type ShowExprVisitor struct {
|
||||
|
@ -164,5 +165,5 @@ func ShowExpr(expr *planpb.Expr) {
|
|||
v := NewShowExprVisitor()
|
||||
js := v.VisitExpr(expr)
|
||||
b, _ := json.MarshalIndent(js, "", " ")
|
||||
fmt.Println(string(b))
|
||||
log.Info("[ShowExpr]", zap.String("expr", string(b)))
|
||||
}
|
||||
|
|
|
@ -58,12 +58,12 @@ func newTestSchema() *schemapb.CollectionSchema {
|
|||
}
|
||||
|
||||
func assertValidExpr(t *testing.T, schema *typeutil.SchemaHelper, exprStr string) {
|
||||
// fmt.Println("expr: ", exprStr)
|
||||
// t.Log("expr: ", exprStr)
|
||||
|
||||
_, err := parseExpr(schema, exprStr)
|
||||
assert.Nil(t, err, exprStr)
|
||||
|
||||
// fmt.Println("AST1:")
|
||||
// t.Log("AST1:")
|
||||
// planparserv2.ShowExpr(expr1)
|
||||
}
|
||||
|
||||
|
@ -75,12 +75,12 @@ func assertValidExprV2(t *testing.T, schema *typeutil.SchemaHelper, exprStr stri
|
|||
assert.Nil(t, err)
|
||||
|
||||
if !planparserv2.CheckPredicatesIdentical(expr1, expr2) {
|
||||
fmt.Println("expr: ", exprStr)
|
||||
t.Log("expr: ", exprStr)
|
||||
|
||||
fmt.Println("AST1:")
|
||||
t.Log("AST1:")
|
||||
planparserv2.ShowExpr(expr1)
|
||||
|
||||
fmt.Println("AST2:")
|
||||
t.Log("AST2:")
|
||||
planparserv2.ShowExpr(expr2)
|
||||
|
||||
t.Errorf("parsed asts are not identical")
|
||||
|
@ -88,8 +88,6 @@ func assertValidExprV2(t *testing.T, schema *typeutil.SchemaHelper, exprStr stri
|
|||
}
|
||||
|
||||
func assertInvalidExpr(t *testing.T, schema *typeutil.SchemaHelper, exprStr string) {
|
||||
// fmt.Println("expr: ", exprStr)
|
||||
|
||||
_, err := parseExpr(schema, exprStr)
|
||||
assert.Error(t, err, exprStr)
|
||||
|
||||
|
@ -116,12 +114,12 @@ func assertValidSearchPlanV2(t *testing.T, schema *schemapb.CollectionSchema, ex
|
|||
assert.NotNil(t, expr2)
|
||||
|
||||
if !planparserv2.CheckPredicatesIdentical(expr1, expr2) {
|
||||
fmt.Println("expr: ", exprStr)
|
||||
t.Log("expr: ", exprStr)
|
||||
|
||||
fmt.Println("AST1:")
|
||||
t.Log("AST1:")
|
||||
planparserv2.ShowExpr(expr1)
|
||||
|
||||
fmt.Println("AST2:")
|
||||
t.Log("AST2:")
|
||||
planparserv2.ShowExpr(expr2)
|
||||
|
||||
t.Errorf("parsed asts are not identical")
|
||||
|
@ -632,7 +630,6 @@ func Test_CheckIdentical(t *testing.T) {
|
|||
largeFloatTermExpr,
|
||||
}
|
||||
for _, input := range inputs {
|
||||
// fmt.Println("expr: ", input)
|
||||
expr1, err := parseExpr(helper, input)
|
||||
assert.NoError(t, err)
|
||||
expr2, err := planparserv2.ParseExpr(helper, input)
|
||||
|
|
|
@ -307,7 +307,7 @@ func TestSegmentAllocator6(t *testing.T) {
|
|||
}
|
||||
_, err = segAllocator.GetSegmentID(1, 1, colName, count, 100)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
t.Log(err)
|
||||
success = false
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,6 @@ package querynode
|
|||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"math"
|
||||
"testing"
|
||||
|
||||
|
@ -291,7 +290,7 @@ func TestSegment_getMemSize(t *testing.T) {
|
|||
var memSize = segment.getMemSize()
|
||||
// assert.Equal(t, memSize, int64(18776064))
|
||||
// not accurate, configuration-dependent.
|
||||
fmt.Printf("memory size of segment: %d\n", memSize)
|
||||
t.Log("memory size of segment: ", memSize)
|
||||
|
||||
deleteSegment(segment)
|
||||
deleteCollection(collection)
|
||||
|
|
|
@ -18,7 +18,6 @@ package querynode
|
|||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
@ -50,10 +49,10 @@ func TestBaseTaskQueue_addUnissuedTask(t *testing.T) {
|
|||
timestamp: 1000,
|
||||
}
|
||||
err := taskQueue.addUnissuedTask(mt)
|
||||
fmt.Println(taskQueue.unissuedTasks.Back().Value.(task).Timestamp())
|
||||
t.Log(taskQueue.unissuedTasks.Back().Value.(task).Timestamp())
|
||||
assert.NoError(t, err)
|
||||
err = taskQueue.addUnissuedTask(mt)
|
||||
fmt.Println(taskQueue.unissuedTasks.Back().Value.(task).Timestamp())
|
||||
t.Log(taskQueue.unissuedTasks.Back().Value.(task).Timestamp())
|
||||
assert.NoError(t, err)
|
||||
mt2 := &mockTask{
|
||||
timestamp: 0,
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
package storage
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
@ -371,7 +370,7 @@ func TestPayload_CGO_ReaderandWriter(t *testing.T) {
|
|||
assert.Nil(t, err)
|
||||
assert.Equal(t, 8, dim)
|
||||
assert.Equal(t, 24, len(binVecs))
|
||||
fmt.Println(binVecs)
|
||||
t.Log(binVecs)
|
||||
|
||||
ibinVecs, dim, err := r.GetDataFromPayload()
|
||||
assert.Nil(t, err)
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
package storage
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
@ -371,7 +370,6 @@ func TestPayload_ReaderAndWriter(t *testing.T) {
|
|||
assert.Nil(t, err)
|
||||
assert.Equal(t, 8, dim)
|
||||
assert.Equal(t, 24, len(binVecs))
|
||||
fmt.Println(binVecs)
|
||||
|
||||
ibinVecs, dim, err := r.GetDataFromPayload()
|
||||
assert.Nil(t, err)
|
||||
|
|
|
@ -41,6 +41,7 @@ func PrintBinlogFiles(fileList []string) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// nolint
|
||||
func printBinlogFile(filename string) error {
|
||||
fd, err := os.OpenFile(filename, os.O_RDONLY, 0400)
|
||||
if err != nil {
|
||||
|
@ -218,6 +219,7 @@ func printBinlogFile(filename string) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// nolint
|
||||
func printPayloadValues(colType schemapb.DataType, reader PayloadReaderInterface) error {
|
||||
fmt.Println("\tpayload values:")
|
||||
switch colType {
|
||||
|
@ -325,6 +327,7 @@ func printPayloadValues(colType schemapb.DataType, reader PayloadReaderInterface
|
|||
return nil
|
||||
}
|
||||
|
||||
// nolint
|
||||
func printDDLPayloadValues(eventType EventTypeCode, colType schemapb.DataType, reader PayloadReaderInterface) error {
|
||||
fmt.Println("\tpayload values:")
|
||||
switch colType {
|
||||
|
@ -384,6 +387,7 @@ func printDDLPayloadValues(eventType EventTypeCode, colType schemapb.DataType, r
|
|||
return nil
|
||||
}
|
||||
|
||||
// nolint
|
||||
// only print slice meta and index params
|
||||
func printIndexFilePayloadValues(reader PayloadReaderInterface, key string, dataType schemapb.DataType) error {
|
||||
if dataType == schemapb.DataType_Int8 {
|
||||
|
|
|
@ -18,7 +18,6 @@ package storage
|
|||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/bits-and-blooms/bloom/v3"
|
||||
|
@ -70,7 +69,7 @@ func TestStatsWriter_BF(t *testing.T) {
|
|||
data := &Int64FieldData{
|
||||
Data: value,
|
||||
}
|
||||
fmt.Println(data.RowNum())
|
||||
t.Log(data.RowNum())
|
||||
sw := &StatsWriter{}
|
||||
err := sw.GeneratePrimaryKeyStats(common.RowIDField, schemapb.DataType_Int64, data)
|
||||
assert.NoError(t, err)
|
||||
|
|
|
@ -20,7 +20,6 @@ import (
|
|||
"bytes"
|
||||
"encoding/binary"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"math/rand"
|
||||
"strconv"
|
||||
"testing"
|
||||
|
@ -1206,6 +1205,6 @@ func TestJson(t *testing.T) {
|
|||
assert.NoError(t, err)
|
||||
ExtraLength := int32(len(ExtraBytes))
|
||||
|
||||
fmt.Print(string(ExtraBytes))
|
||||
fmt.Println(ExtraLength)
|
||||
t.Log(string(ExtraBytes))
|
||||
t.Log(ExtraLength)
|
||||
}
|
||||
|
|
|
@ -17,46 +17,45 @@
|
|||
package tracer
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func testStackTrace() {
|
||||
fmt.Println(StackTraceMsg(1))
|
||||
fmt.Println(StackTraceMsg(5))
|
||||
fmt.Println(StackTraceMsg(10))
|
||||
func testStackTrace(t *testing.T) {
|
||||
t.Log(StackTraceMsg(1))
|
||||
t.Log(StackTraceMsg(5))
|
||||
t.Log(StackTraceMsg(10))
|
||||
|
||||
fmt.Println(StackTrace())
|
||||
t.Log(StackTrace())
|
||||
}
|
||||
|
||||
func TestStackTraceMsg(t *testing.T) {
|
||||
fmt.Println(StackTraceMsg(1))
|
||||
fmt.Println(StackTraceMsg(5))
|
||||
fmt.Println(StackTraceMsg(10))
|
||||
t.Log(StackTraceMsg(1))
|
||||
t.Log(StackTraceMsg(5))
|
||||
t.Log(StackTraceMsg(10))
|
||||
|
||||
func() {
|
||||
fmt.Println(StackTraceMsg(10))
|
||||
t.Log(StackTraceMsg(10))
|
||||
}()
|
||||
|
||||
func() {
|
||||
func() {
|
||||
fmt.Println(StackTraceMsg(10))
|
||||
t.Log(StackTraceMsg(10))
|
||||
}()
|
||||
}()
|
||||
|
||||
testStackTrace()
|
||||
testStackTrace(t)
|
||||
}
|
||||
|
||||
func TestStackTrace(t *testing.T) {
|
||||
fmt.Println(StackTrace())
|
||||
t.Log(StackTrace())
|
||||
|
||||
func() {
|
||||
fmt.Println(StackTrace())
|
||||
t.Log(StackTrace())
|
||||
}()
|
||||
|
||||
func() {
|
||||
func() {
|
||||
fmt.Println(StackTrace())
|
||||
t.Log(StackTrace())
|
||||
}()
|
||||
}()
|
||||
}
|
||||
|
|
|
@ -18,7 +18,6 @@ package grpcclient
|
|||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
"math/rand"
|
||||
"net"
|
||||
|
@ -353,7 +352,6 @@ func TestClientBase_RetryPolicy(t *testing.T) {
|
|||
ctx := context.Background()
|
||||
randID := rand.Int63()
|
||||
res, err := clientBase.Call(ctx, func(client rootcoordpb.RootCoordClient) (any, error) {
|
||||
fmt.Println("client base...")
|
||||
return &milvuspb.ComponentStates{State: &milvuspb.ComponentInfo{
|
||||
NodeID: randID,
|
||||
}}, nil
|
||||
|
@ -416,7 +414,6 @@ func TestClientBase_Compression(t *testing.T) {
|
|||
ctx := context.Background()
|
||||
randID := rand.Int63()
|
||||
res, err := clientBase.Call(ctx, func(client rootcoordpb.RootCoordClient) (any, error) {
|
||||
fmt.Println("client base...")
|
||||
return &milvuspb.ComponentStates{State: &milvuspb.ComponentInfo{
|
||||
NodeID: randID,
|
||||
}}, nil
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
package indexparamcheck
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strconv"
|
||||
"testing"
|
||||
)
|
||||
|
@ -161,7 +160,7 @@ func TestIVFPQConfAdapter_CheckTrain(t *testing.T) {
|
|||
adapter := newIVFPQConfAdapter()
|
||||
for i, test := range cases {
|
||||
if got := adapter.CheckTrain(test.params); got != test.want {
|
||||
fmt.Printf("i: %d, params: %v\n", i, test.params)
|
||||
t.Log("i:", i, "params", test.params)
|
||||
t.Errorf("IVFPQConfAdapter.CheckTrain(%v) = %v", test.params, test.want)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
package ratelimitutil
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"math"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
|
@ -322,12 +321,12 @@ func TestLongRunningQPS(t *testing.T) {
|
|||
ideal := burst + (limit * float64(elapsed) / float64(time.Second))
|
||||
|
||||
// We should never get more requests than allowed.
|
||||
fmt.Printf("numOK = %d, want %d (ideal %f)\n", numOK, int32(ideal), ideal)
|
||||
t.Log("numOK =", numOK, "want", int32(ideal), "ideal", ideal)
|
||||
if want := int32(ideal); numOK > want {
|
||||
t.Errorf("numOK = %d, want %d (ideal %f)", numOK, want, ideal)
|
||||
}
|
||||
// We should get very close to the number of requests allowed.
|
||||
fmt.Printf("numOK = %d, want %d (ideal %f)\n", numOK, int32(0.999*ideal), ideal)
|
||||
t.Log("numOK =", numOK, "want", int32(0.999*ideal), "ideal", ideal)
|
||||
if want := int32(0.999 * ideal); numOK < want {
|
||||
t.Errorf("numOK = %d, want %d (ideal %f)", numOK, want, ideal)
|
||||
}
|
||||
|
|
|
@ -195,6 +195,7 @@ func (r *RateCollector) update(now time.Time) {
|
|||
}
|
||||
}
|
||||
|
||||
// nolint
|
||||
// print is a helper function to print values.
|
||||
func (r *RateCollector) print() {
|
||||
for k, v := range r.values {
|
||||
|
|
|
@ -48,7 +48,7 @@ func TestAttempts(t *testing.T) {
|
|||
|
||||
err := Do(ctx, testFn, Attempts(1))
|
||||
assert.NotNil(t, err)
|
||||
fmt.Println(err)
|
||||
t.Log(err)
|
||||
}
|
||||
|
||||
func TestMaxSleepTime(t *testing.T) {
|
||||
|
@ -60,7 +60,7 @@ func TestMaxSleepTime(t *testing.T) {
|
|||
|
||||
err := Do(ctx, testFn, Attempts(3), MaxSleepTime(200*time.Millisecond))
|
||||
assert.NotNil(t, err)
|
||||
fmt.Println(err)
|
||||
t.Log(err)
|
||||
}
|
||||
|
||||
func TestSleep(t *testing.T) {
|
||||
|
@ -72,7 +72,7 @@ func TestSleep(t *testing.T) {
|
|||
|
||||
err := Do(ctx, testFn, Attempts(3), Sleep(500*time.Millisecond))
|
||||
assert.NotNil(t, err)
|
||||
fmt.Println(err)
|
||||
t.Log(err)
|
||||
}
|
||||
|
||||
func TestAllError(t *testing.T) {
|
||||
|
@ -84,7 +84,7 @@ func TestAllError(t *testing.T) {
|
|||
|
||||
err := Do(ctx, testFn, Attempts(3))
|
||||
assert.NotNil(t, err)
|
||||
fmt.Println(err)
|
||||
t.Log(err)
|
||||
}
|
||||
|
||||
func TestUnRecoveryError(t *testing.T) {
|
||||
|
@ -113,7 +113,7 @@ func TestContextDeadline(t *testing.T) {
|
|||
|
||||
err := Do(ctx, testFn)
|
||||
assert.NotNil(t, err)
|
||||
fmt.Println(err)
|
||||
t.Log(err)
|
||||
}
|
||||
|
||||
func TestContextCancel(t *testing.T) {
|
||||
|
@ -130,5 +130,5 @@ func TestContextCancel(t *testing.T) {
|
|||
|
||||
err := Do(ctx, testFn)
|
||||
assert.NotNil(t, err)
|
||||
fmt.Println(err)
|
||||
t.Log(err)
|
||||
}
|
||||
|
|
|
@ -418,7 +418,7 @@ func (s *Session) registerService() (<-chan *clientv3.LeaseKeepAliveResponse, er
|
|||
}
|
||||
ch, err = s.etcdCli.KeepAlive(keepAliveCtx, resp.ID)
|
||||
if err != nil {
|
||||
fmt.Printf("got error during keeping alive with etcd, err: %s\n", err)
|
||||
log.Warn("go error during keeping alive with etcd", zap.Error(err))
|
||||
return err
|
||||
}
|
||||
log.Info("Service registered successfully", zap.String("ServerName", s.ServerName), zap.Int64("serverID", s.ServerID))
|
||||
|
|
|
@ -24,6 +24,8 @@ import (
|
|||
|
||||
"github.com/golang/protobuf/proto"
|
||||
"github.com/milvus-io/milvus/internal/common"
|
||||
"github.com/milvus-io/milvus/internal/log"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
// Generic Clone for proto message
|
||||
|
@ -98,7 +100,7 @@ func Uint64ToBytes(v uint64) []byte {
|
|||
// SliceRemoveDuplicate is used to dedup a Slice
|
||||
func SliceRemoveDuplicate(a interface{}) (ret []interface{}) {
|
||||
if reflect.TypeOf(a).Kind() != reflect.Slice {
|
||||
fmt.Printf("input is not slice but %T\n", a)
|
||||
log.Error("input is not slice", zap.String("inputType", fmt.Sprintf("%T", a)))
|
||||
return ret
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue