mirror of https://github.com/milvus-io/milvus.git
issue: https://github.com/milvus-io/milvus/issues/29048 pr: https://github.com/milvus-io/milvus/pull/29071 --------- Signed-off-by: longjiquan <jiquan.long@zilliz.com>pull/29153/head
parent
286dce0d3a
commit
00e6160848
|
@ -4,6 +4,10 @@ type flatChecker struct {
|
|||
floatVectorBaseChecker
|
||||
}
|
||||
|
||||
func (c flatChecker) StaticCheck(m map[string]string) error {
|
||||
return c.staticCheck(m)
|
||||
}
|
||||
|
||||
func newFlatChecker() IndexChecker {
|
||||
return &flatChecker{}
|
||||
}
|
||||
|
|
|
@ -62,3 +62,40 @@ func Test_flatChecker_CheckTrain(t *testing.T) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
func Test_flatChecker_StaticCheck(t *testing.T) {
|
||||
cases := []struct {
|
||||
params map[string]string
|
||||
errIsNil bool
|
||||
}{
|
||||
{
|
||||
// metrics not found.
|
||||
params: map[string]string{},
|
||||
errIsNil: false,
|
||||
},
|
||||
{
|
||||
// invalid metric.
|
||||
params: map[string]string{
|
||||
Metric: metric.HAMMING,
|
||||
},
|
||||
errIsNil: false,
|
||||
},
|
||||
{
|
||||
// normal case.
|
||||
params: map[string]string{
|
||||
Metric: metric.L2,
|
||||
},
|
||||
errIsNil: true,
|
||||
},
|
||||
}
|
||||
|
||||
c := newFlatChecker()
|
||||
for _, test := range cases {
|
||||
err := c.StaticCheck(test.params)
|
||||
if test.errIsNil {
|
||||
assert.NoError(t, err)
|
||||
} else {
|
||||
assert.Error(t, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue