diff --git a/pkg/util/indexparamcheck/flat_checker.go b/pkg/util/indexparamcheck/flat_checker.go index eea107df02..d98db44920 100644 --- a/pkg/util/indexparamcheck/flat_checker.go +++ b/pkg/util/indexparamcheck/flat_checker.go @@ -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{} } diff --git a/pkg/util/indexparamcheck/flat_checker_test.go b/pkg/util/indexparamcheck/flat_checker_test.go index 115fd83931..c22432bc6f 100644 --- a/pkg/util/indexparamcheck/flat_checker_test.go +++ b/pkg/util/indexparamcheck/flat_checker_test.go @@ -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) + } + } +}