From caaf9b1ea4a075b11f5c60962e4981bb9d027ff1 Mon Sep 17 00:00:00 2001 From: ThreadDao Date: Fri, 9 May 2025 10:14:54 +0800 Subject: [PATCH] test: fix property case and remove load default replicaNum value (#41674) issue: #41673 --------- Signed-off-by: ThreadDao --- client/milvusclient/maintenance_options.go | 8 ++++---- tests/go_client/testcases/database_test.go | 11 +++++++++-- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/client/milvusclient/maintenance_options.go b/client/milvusclient/maintenance_options.go index b0476ac342..e4a183ffdb 100644 --- a/client/milvusclient/maintenance_options.go +++ b/client/milvusclient/maintenance_options.go @@ -84,8 +84,8 @@ func (opt *loadCollectionOption) WithRefresh(isRefresh bool) *loadCollectionOpti func NewLoadCollectionOption(collectionName string) *loadCollectionOption { return &loadCollectionOption{ collectionName: collectionName, - replicaNum: 1, - interval: time.Millisecond * 200, + // replicaNum: 1, The default value of the replicaNum should be set on the server side + interval: time.Millisecond * 200, } } @@ -156,8 +156,8 @@ func NewLoadPartitionsOption(collectionName string, partitionsNames ...string) * return &loadPartitionsOption{ collectionName: collectionName, partitionNames: partitionsNames, - replicaNum: 1, - interval: time.Millisecond * 200, + // replicaNum: 1, The default value of the replicaNum should be set on the server side + interval: time.Millisecond * 200, } } diff --git a/tests/go_client/testcases/database_test.go b/tests/go_client/testcases/database_test.go index 6d558ced8d..c6d0efb116 100644 --- a/tests/go_client/testcases/database_test.go +++ b/tests/go_client/testcases/database_test.go @@ -358,8 +358,15 @@ func TestDatabasePropertiesRgReplicas(t *testing.T) { prepare.FlushData(ctx, t, mc, schema.CollectionName) prepare.CreateIndex(ctx, t, mc, hp.TNewIndexParams(schema)) - _, err = mc.LoadCollection(ctx, client.NewLoadCollectionOption(schema.CollectionName)) - common.CheckErr(t, err, true) + // When load does not specify parameters, rg and replica Properties take effect + _, errLoad := mc.LoadCollection(ctx, client.NewLoadCollectionOption(schema.CollectionName)) + common.CheckErr(t, errLoad, false, "resource group not found", "service resource insufficient") + + // actually load with default rg, rg1 not existed + taskLoad, errLoad := mc.LoadCollection(ctx, client.NewLoadCollectionOption(schema.CollectionName).WithReplica(1)) + common.CheckErr(t, errLoad, true) + errLoad = taskLoad.Await(ctx) + common.CheckErr(t, errLoad, true) _, err = mc.Query(ctx, client.NewQueryOption(schema.CollectionName).WithLimit(10)) common.CheckErr(t, err, true)