Skip to content

Commit

Permalink
test: fix case TestLoadEmptyPartitionName (#853)
Browse files Browse the repository at this point in the history
Signed-off-by: ThreadDao <[email protected]>
  • Loading branch information
ThreadDao authored Dec 9, 2024
1 parent 807a6cc commit 4ed7055
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions test/testcases/load_release_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,23 +128,30 @@ func TestLoadCollectionMultiPartitions(t *testing.T) {
// require.True(t, collection.Loaded)
}

// test load with empty partition name ""
// test load with empty partition name "" -> default partition
func TestLoadEmptyPartitionName(t *testing.T) {
ctx := createContext(t, time.Second*common.DefaultTimeout*3)
// connect
mc := createMilvusClient(ctx, t)

// create collection and insert [0, nb) into default partition, [nb, nb*2) into new partition
nb := 500
collName := createDefaultCollection(ctx, t, mc, false, common.DefaultShards)
createInsertTwoPartitions(ctx, t, mc, collName, 500)
parName, _, _ := createInsertTwoPartitions(ctx, t, mc, collName, nb)

// create index
idx, _ := entity.NewIndexHNSW(entity.L2, 8, 96)
mc.CreateIndex(ctx, collName, common.DefaultFloatVecFieldName, idx, false)

// load partition with empty partition names
// load partition with empty partition names -> actually default
errLoadEmpty := mc.LoadPartitions(ctx, collName, []string{""}, false)
common.CheckErr(t, errLoadEmpty, false, "partition not found[partition=]")
common.CheckErr(t, errLoadEmpty, true)

countDef, _ := mc.Query(ctx, collName, []string{common.DefaultPartition}, "", []string{common.QueryCountFieldName})
require.Equal(t, int64(nb), countDef.GetColumn(common.QueryCountFieldName).(*entity.ColumnInt64).Data()[0])

_, errPar := mc.Query(ctx, collName, []string{parName}, "", []string{common.QueryCountFieldName})
common.CheckErr(t, errPar, false, "partition not loaded")
}

// test load partitions with empty slice []string{}
Expand Down

0 comments on commit 4ed7055

Please sign in to comment.