milvus/pkg/util/ratelimitutil/utils_test.go
SimFG c012e6786f
feat: support rate limiter based on db and partition levels (#31070)
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>
2024-04-12 16:01:19 +08:00

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)
}
})
}
}