mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-11-29 18:38:44 +08:00
test: Update go_client version & update latest changes (#37793)
Related to #37768 --------- Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
This commit is contained in:
parent
27c22d1166
commit
6b23e668b0
@ -5,7 +5,7 @@ go 1.21
|
|||||||
toolchain go1.21.11
|
toolchain go1.21.11
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/milvus-io/milvus/client/v2 v2.0.0-20241111031027-fca946dee181
|
github.com/milvus-io/milvus/client/v2 v2.0.0-20241125024034-0b9edb62a92d
|
||||||
github.com/milvus-io/milvus/pkg v0.0.2-0.20241111021426-5e90f348fcbb
|
github.com/milvus-io/milvus/pkg v0.0.2-0.20241111021426-5e90f348fcbb
|
||||||
github.com/quasilyte/go-ruleguard/dsl v0.3.22
|
github.com/quasilyte/go-ruleguard/dsl v0.3.22
|
||||||
github.com/stretchr/testify v1.9.0
|
github.com/stretchr/testify v1.9.0
|
||||||
@ -52,7 +52,7 @@ require (
|
|||||||
github.com/kr/text v0.2.0 // indirect
|
github.com/kr/text v0.2.0 // indirect
|
||||||
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect
|
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect
|
||||||
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
|
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
|
||||||
github.com/milvus-io/milvus-proto/go-api/v2 v2.3.4-0.20241111025219-806678b2806e // indirect
|
github.com/milvus-io/milvus-proto/go-api/v2 v2.3.4-0.20241120015424-93892e628c69 // indirect
|
||||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||||
github.com/opencontainers/runtime-spec v1.0.2 // indirect
|
github.com/opencontainers/runtime-spec v1.0.2 // indirect
|
||||||
|
@ -318,10 +318,10 @@ github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfr
|
|||||||
github.com/mediocregopher/radix/v3 v3.4.2/go.mod h1:8FL3F6UQRXHXIBSPUs5h0RybMF8i4n7wVopoX3x7Bv8=
|
github.com/mediocregopher/radix/v3 v3.4.2/go.mod h1:8FL3F6UQRXHXIBSPUs5h0RybMF8i4n7wVopoX3x7Bv8=
|
||||||
github.com/microcosm-cc/bluemonday v1.0.2/go.mod h1:iVP4YcDBq+n/5fb23BhYFvIMq/leAFZyRl6bYmGDlGc=
|
github.com/microcosm-cc/bluemonday v1.0.2/go.mod h1:iVP4YcDBq+n/5fb23BhYFvIMq/leAFZyRl6bYmGDlGc=
|
||||||
github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
|
github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
|
||||||
github.com/milvus-io/milvus-proto/go-api/v2 v2.3.4-0.20241111025219-806678b2806e h1:vablXYYktqJjTuSDUkNNNRigkGuJVHLXr34xoiE7GR0=
|
github.com/milvus-io/milvus-proto/go-api/v2 v2.3.4-0.20241120015424-93892e628c69 h1:Qt0Bv2Fum3EX3OlkuQYHJINBzeU4oEuHy2lXSfB/gZw=
|
||||||
github.com/milvus-io/milvus-proto/go-api/v2 v2.3.4-0.20241111025219-806678b2806e/go.mod h1:/6UT4zZl6awVeXLeE7UGDWZvXj3IWkRsh3mqsn0DiAs=
|
github.com/milvus-io/milvus-proto/go-api/v2 v2.3.4-0.20241120015424-93892e628c69/go.mod h1:/6UT4zZl6awVeXLeE7UGDWZvXj3IWkRsh3mqsn0DiAs=
|
||||||
github.com/milvus-io/milvus/client/v2 v2.0.0-20241111031027-fca946dee181 h1:YHpgSTEnfm71INTQ4BnbFmx56DSvWJEv7j2XitL/Ueo=
|
github.com/milvus-io/milvus/client/v2 v2.0.0-20241125024034-0b9edb62a92d h1:B9O725cOdoVt3Yosnv7ux/LGfFAZtGR+ap19OhYWgUM=
|
||||||
github.com/milvus-io/milvus/client/v2 v2.0.0-20241111031027-fca946dee181/go.mod h1:Y5KeQdPOEV7fICgAW7HDnprnwBWhapr7K11yRD/THdg=
|
github.com/milvus-io/milvus/client/v2 v2.0.0-20241125024034-0b9edb62a92d/go.mod h1:8n6FsmUmL0BUlAna1e7LIIijQSIyo76RCSGFbnDcPp8=
|
||||||
github.com/milvus-io/milvus/pkg v0.0.2-0.20241111021426-5e90f348fcbb h1:lMyIrG03agASB88AAwnk+NOU9V33lcBdtub/ZEv6IQU=
|
github.com/milvus-io/milvus/pkg v0.0.2-0.20241111021426-5e90f348fcbb h1:lMyIrG03agASB88AAwnk+NOU9V33lcBdtub/ZEv6IQU=
|
||||||
github.com/milvus-io/milvus/pkg v0.0.2-0.20241111021426-5e90f348fcbb/go.mod h1:w5nu1Z318AvgWQrGUYXaqLeVLu4JvCS/oYhxqctOZvU=
|
github.com/milvus-io/milvus/pkg v0.0.2-0.20241111021426-5e90f348fcbb/go.mod h1:w5nu1Z318AvgWQrGUYXaqLeVLu4JvCS/oYhxqctOZvU=
|
||||||
github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc=
|
github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc=
|
||||||
|
@ -179,13 +179,13 @@ func GenArrayColumnData(nb int, eleType entity.FieldType, option GenDataOption)
|
|||||||
}
|
}
|
||||||
return column.NewColumnDoubleArray(fieldName, doubleValues)
|
return column.NewColumnDoubleArray(fieldName, doubleValues)
|
||||||
case entity.FieldTypeVarChar:
|
case entity.FieldTypeVarChar:
|
||||||
varcharValues := make([][][]byte, 0, nb)
|
varcharValues := make([][]string, 0, nb)
|
||||||
for i := start; i < start+nb; i++ {
|
for i := start; i < start+nb; i++ {
|
||||||
varcharArray := make([][]byte, 0, capacity)
|
varcharArray := make([]string, 0, capacity)
|
||||||
for j := 0; j < capacity; j++ {
|
for j := 0; j < capacity; j++ {
|
||||||
var buf bytes.Buffer
|
var buf bytes.Buffer
|
||||||
buf.WriteString(strconv.Itoa(i + j))
|
buf.WriteString(strconv.Itoa(i + j))
|
||||||
varcharArray = append(varcharArray, buf.Bytes())
|
varcharArray = append(varcharArray, buf.String())
|
||||||
}
|
}
|
||||||
varcharValues = append(varcharValues, varcharArray)
|
varcharValues = append(varcharValues, varcharArray)
|
||||||
}
|
}
|
||||||
|
@ -301,7 +301,7 @@ func TestInsertColumnsMismatchFields(t *testing.T) {
|
|||||||
|
|
||||||
// len(column) < len(fields)
|
// len(column) < len(fields)
|
||||||
_, errInsert := mc.Insert(ctx, client.NewColumnBasedInsertOption(collName, intColumn))
|
_, errInsert := mc.Insert(ctx, client.NewColumnBasedInsertOption(collName, intColumn))
|
||||||
common.CheckErr(t, errInsert, false, "not passed")
|
common.CheckErr(t, errInsert, false, "has no corresponding fieldData pass in: invalid parameter")
|
||||||
|
|
||||||
// len(column) > len(fields)
|
// len(column) > len(fields)
|
||||||
_, errInsert2 := mc.Insert(ctx, client.NewColumnBasedInsertOption(collName, intColumn, vecColumn, vecColumn))
|
_, errInsert2 := mc.Insert(ctx, client.NewColumnBasedInsertOption(collName, intColumn, vecColumn, vecColumn))
|
||||||
|
@ -161,7 +161,7 @@ func TestSearchPartitions(t *testing.T) {
|
|||||||
queryRes, _ := mc.Query(ctx, client.NewQueryOption(schema.CollectionName).WithFilter(fmt.Sprintf("int64 in [%d, %d]", _defId0, _parId0)).WithOutputFields("*"))
|
queryRes, _ := mc.Query(ctx, client.NewQueryOption(schema.CollectionName).WithFilter(fmt.Sprintf("int64 in [%d, %d]", _defId0, _parId0)).WithOutputFields("*"))
|
||||||
require.ElementsMatch(t, []int64{_defId0, _parId0}, queryRes.GetColumn(common.DefaultInt64FieldName).(*column.ColumnInt64).Data())
|
require.ElementsMatch(t, []int64{_defId0, _parId0}, queryRes.GetColumn(common.DefaultInt64FieldName).(*column.ColumnInt64).Data())
|
||||||
for _, vec := range queryRes.GetColumn(common.DefaultFloatVecFieldName).(*column.ColumnFloatVector).Data() {
|
for _, vec := range queryRes.GetColumn(common.DefaultFloatVecFieldName).(*column.ColumnFloatVector).Data() {
|
||||||
vectors = append(vectors, entity.FloatVector(vec))
|
vectors = append(vectors, vec)
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, partitions := range [][]string{{}, {common.DefaultPartition, parName}} {
|
for _, partitions := range [][]string{{}, {common.DefaultPartition, parName}} {
|
||||||
@ -174,8 +174,8 @@ func TestSearchPartitions(t *testing.T) {
|
|||||||
common.CheckSearchResult(t, searchResult, len(vectors), 5)
|
common.CheckSearchResult(t, searchResult, len(vectors), 5)
|
||||||
require.Contains(t, searchResult[0].IDs.(*column.ColumnInt64).Data(), _defId0)
|
require.Contains(t, searchResult[0].IDs.(*column.ColumnInt64).Data(), _defId0)
|
||||||
require.Contains(t, searchResult[1].IDs.(*column.ColumnInt64).Data(), _parId0)
|
require.Contains(t, searchResult[1].IDs.(*column.ColumnInt64).Data(), _parId0)
|
||||||
require.EqualValues(t, entity.FloatVector(searchResult[0].GetColumn(common.DefaultFloatVecFieldName).(*column.ColumnFloatVector).Data()[0]), vectors[0])
|
require.EqualValues(t, searchResult[0].GetColumn(common.DefaultFloatVecFieldName).(*column.ColumnFloatVector).Data()[0], vectors[0])
|
||||||
require.EqualValues(t, entity.FloatVector(searchResult[1].GetColumn(common.DefaultFloatVecFieldName).(*column.ColumnFloatVector).Data()[0]), vectors[1])
|
require.EqualValues(t, searchResult[1].GetColumn(common.DefaultFloatVecFieldName).(*column.ColumnFloatVector).Data()[0], vectors[1])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -344,7 +344,7 @@ func TestUpsertNotExistCollectionPartition(t *testing.T) {
|
|||||||
_, schema := hp.CollPrepare.CreateCollection(ctx, t, mc, hp.NewCreateCollectionParams(hp.Int64Vec), hp.TNewFieldsOption(), hp.TNewSchemaOption())
|
_, schema := hp.CollPrepare.CreateCollection(ctx, t, mc, hp.NewCreateCollectionParams(hp.Int64Vec), hp.TNewFieldsOption(), hp.TNewSchemaOption())
|
||||||
|
|
||||||
_, errUpsert = mc.Upsert(ctx, client.NewColumnBasedInsertOption(schema.CollectionName).WithPartition("aaa"))
|
_, errUpsert = mc.Upsert(ctx, client.NewColumnBasedInsertOption(schema.CollectionName).WithPartition("aaa"))
|
||||||
common.CheckErr(t, errUpsert, false, "field int64 not passed")
|
common.CheckErr(t, errUpsert, false, "num_rows should be greater than 0")
|
||||||
|
|
||||||
// upsert not exist partition
|
// upsert not exist partition
|
||||||
opt := *hp.TNewDataOption()
|
opt := *hp.TNewDataOption()
|
||||||
@ -366,7 +366,7 @@ func TestUpsertInvalidColumnData(t *testing.T) {
|
|||||||
opt := *hp.TNewDataOption()
|
opt := *hp.TNewDataOption()
|
||||||
pkColumn, vecColumn := hp.GenColumnData(upsertNb, entity.FieldTypeInt64, opt), hp.GenColumnData(upsertNb, entity.FieldTypeFloatVector, opt)
|
pkColumn, vecColumn := hp.GenColumnData(upsertNb, entity.FieldTypeInt64, opt), hp.GenColumnData(upsertNb, entity.FieldTypeFloatVector, opt)
|
||||||
_, err := mc.Upsert(ctx, client.NewColumnBasedInsertOption(schema.CollectionName).WithColumns(pkColumn))
|
_, err := mc.Upsert(ctx, client.NewColumnBasedInsertOption(schema.CollectionName).WithColumns(pkColumn))
|
||||||
common.CheckErr(t, err, false, fmt.Sprintf("field %s not passed", common.DefaultFloatVecFieldName))
|
common.CheckErr(t, err, false, fmt.Sprintf("fieldSchema(%s) has no corresponding fieldData pass in", common.DefaultFloatVecFieldName))
|
||||||
|
|
||||||
// 2. upsert extra a column
|
// 2. upsert extra a column
|
||||||
_, err = mc.Upsert(ctx, client.NewColumnBasedInsertOption(schema.CollectionName).WithColumns(pkColumn, vecColumn, vecColumn))
|
_, err = mc.Upsert(ctx, client.NewColumnBasedInsertOption(schema.CollectionName).WithColumns(pkColumn, vecColumn, vecColumn))
|
||||||
|
Loading…
Reference in New Issue
Block a user