mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-12-02 20:09:57 +08:00
c012e6786f
issue: https://github.com/milvus-io/milvus/issues/30577 co-author: @jaime0815 --------- Signed-off-by: Patrick Weizhi Xu <weizhi.xu@zilliz.com> Signed-off-by: SimFG <bang.fu@zilliz.com> Co-authored-by: Patrick Weizhi Xu <weizhi.xu@zilliz.com>
44 lines
1.0 KiB
Go
44 lines
1.0 KiB
Go
package ratelimitutil
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/milvus-io/milvus-proto/go-api/v2/commonpb"
|
|
)
|
|
|
|
func TestGetQuotaErrorString(t *testing.T) {
|
|
tests := []struct {
|
|
name string
|
|
args commonpb.ErrorCode
|
|
want string
|
|
}{
|
|
{
|
|
name: "Test ErrorCode_ForceDeny",
|
|
args: commonpb.ErrorCode_ForceDeny,
|
|
want: "the writing has been deactivated by the administrator",
|
|
},
|
|
{
|
|
name: "Test ErrorCode_MemoryQuotaExhausted",
|
|
args: commonpb.ErrorCode_MemoryQuotaExhausted,
|
|
want: "memory quota exceeded, please allocate more resources",
|
|
},
|
|
{
|
|
name: "Test ErrorCode_DiskQuotaExhausted",
|
|
args: commonpb.ErrorCode_DiskQuotaExhausted,
|
|
want: "disk quota exceeded, please allocate more resources",
|
|
},
|
|
{
|
|
name: "Test ErrorCode_TimeTickLongDelay",
|
|
args: commonpb.ErrorCode_TimeTickLongDelay,
|
|
want: "time tick long delay",
|
|
},
|
|
}
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
if got := GetQuotaErrorString(tt.args); got != tt.want {
|
|
t.Errorf("GetQuotaErrorString() = %v, want %v", got, tt.want)
|
|
}
|
|
})
|
|
}
|
|
}
|