enhance: Remove `TestRateLimiter/tests_refresh_rate_by_config` case (#32545)

See also #32313

This case always fail since the watch config logic is removed

Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
pull/32549/head^2
congqixia 2024-04-24 10:13:24 +08:00 committed by GitHub
parent 29922829da
commit dcc15e3ed8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 0 additions and 43 deletions

View File

@ -17,12 +17,9 @@
package proxy
import (
"context"
"fmt"
"math"
"math/rand"
"testing"
"time"
"github.com/stretchr/testify/assert"
@ -31,7 +28,6 @@ import (
"github.com/milvus-io/milvus/internal/proto/internalpb"
"github.com/milvus-io/milvus/internal/proto/proxypb"
rlinternal "github.com/milvus-io/milvus/internal/util/ratelimitutil"
"github.com/milvus-io/milvus/pkg/util/etcd"
"github.com/milvus-io/milvus/pkg/util/merr"
"github.com/milvus-io/milvus/pkg/util/paramtable"
"github.com/milvus-io/milvus/pkg/util/ratelimitutil"
@ -373,43 +369,4 @@ func TestRateLimiter(t *testing.T) {
assert.Error(t, collectionRateLimiters.GetQuotaExceededError(internalpb.RateType_DQLQuery))
assert.Error(t, collectionRateLimiters.GetQuotaExceededError(internalpb.RateType_DMLInsert))
})
t.Run("tests refresh rate by config", func(t *testing.T) {
simpleLimiter := NewSimpleLimiter()
clusterRateLimiter := simpleLimiter.rateLimiter.GetRootLimiters()
etcdCli, _ := etcd.GetEtcdClient(
Params.EtcdCfg.UseEmbedEtcd.GetAsBool(),
Params.EtcdCfg.EtcdUseSSL.GetAsBool(),
Params.EtcdCfg.Endpoints.GetAsStrings(),
Params.EtcdCfg.EtcdTLSCert.GetValue(),
Params.EtcdCfg.EtcdTLSKey.GetValue(),
Params.EtcdCfg.EtcdTLSCACert.GetValue(),
Params.EtcdCfg.EtcdTLSMinVersion.GetValue())
Params.Save(Params.QuotaConfig.DDLLimitEnabled.Key, "true")
defer Params.Reset(Params.QuotaConfig.DDLLimitEnabled.Key)
Params.Save(Params.QuotaConfig.DMLLimitEnabled.Key, "true")
defer Params.Reset(Params.QuotaConfig.DMLLimitEnabled.Key)
ctx := context.Background()
// avoid production precision issues when comparing 0-terminated numbers
r := rand.Float64()
newRate := fmt.Sprintf("%.2f", r)
etcdCli.KV.Put(ctx, "by-dev/config/quotaAndLimits/ddl/collectionRate", newRate)
defer etcdCli.KV.Delete(ctx, "by-dev/config/quotaAndLimits/ddl/collectionRate")
etcdCli.KV.Put(ctx, "by-dev/config/quotaAndLimits/ddl/partitionRate", "invalid")
defer etcdCli.KV.Delete(ctx, "by-dev/config/quotaAndLimits/ddl/partitionRate")
etcdCli.KV.Put(ctx, "by-dev/config/quotaAndLimits/dml/insertRate/max", "8")
defer etcdCli.KV.Delete(ctx, "by-dev/config/quotaAndLimits/dml/insertRate/max")
assert.Eventually(t, func() bool {
limit, _ := clusterRateLimiter.GetLimiters().Get(internalpb.RateType_DDLCollection)
return math.Abs(r-float64(limit.Limit())) < 0.01
}, 10*time.Second, 1*time.Second)
limit, _ := clusterRateLimiter.GetLimiters().Get(internalpb.RateType_DDLPartition)
assert.Equal(t, "+inf", limit.Limit().String())
limit, _ = clusterRateLimiter.GetLimiters().Get(internalpb.RateType_DMLInsert)
assert.True(t, math.Abs(8*1024*1024-float64(limit.Limit())) < 0.01)
})
}