mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-12-02 11:59:00 +08:00
fix get partition progress return wrong error msg (#24899)
Signed-off-by: Wei Liu <wei.liu@zilliz.com>
This commit is contained in:
parent
db31e88a73
commit
59457eb75b
@ -1191,6 +1191,16 @@ func getPartitionProgress(
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
if resp.GetStatus().GetErrorCode() != commonpb.ErrorCode_Success {
|
||||
err = merr.Error(resp.GetStatus())
|
||||
log.Warn("fail to show partitions",
|
||||
zap.String("collection_name", collectionName),
|
||||
zap.Strings("partition_names", partitionNames),
|
||||
zap.String("reason", resp.Status.Reason))
|
||||
return
|
||||
}
|
||||
|
||||
if len(resp.InMemoryPercentages) != len(partitionIDs) {
|
||||
errMsg := "fail to show partitions from the querycoord, invalid data num"
|
||||
err = errors.New(errMsg)
|
||||
|
@ -1765,3 +1765,15 @@ func Test_TopKLimit(t *testing.T) {
|
||||
assert.Error(t, validateTopKLimit(16385))
|
||||
assert.Error(t, validateTopKLimit(0))
|
||||
}
|
||||
|
||||
func Test_GetPartitionProgressFailed(t *testing.T) {
|
||||
qc := types.NewMockQueryCoord(t)
|
||||
qc.EXPECT().ShowPartitions(mock.Anything, mock.Anything).Return(&querypb.ShowPartitionsResponse{
|
||||
Status: &commonpb.Status{
|
||||
ErrorCode: commonpb.ErrorCode_UnexpectedError,
|
||||
Reason: "Unexpected error",
|
||||
},
|
||||
}, nil)
|
||||
_, _, err := getPartitionProgress(context.TODO(), qc, &commonpb.MsgBase{}, []string{}, "", 1)
|
||||
assert.Error(t, err)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user