mirror of
https://gitee.com/milvus-io/milvus.git
synced 2025-12-07 01:28:27 +08:00
Fix the unstable resource manager testcase (#28033)
Signed-off-by: SimFG <bang.fu@zilliz.com>
This commit is contained in:
parent
b596d8e75b
commit
ef68680639
@ -6,7 +6,9 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
|
"google.golang.org/grpc/codes"
|
||||||
"google.golang.org/grpc/metadata"
|
"google.golang.org/grpc/metadata"
|
||||||
|
"google.golang.org/grpc/status"
|
||||||
|
|
||||||
"github.com/milvus-io/milvus/pkg/log"
|
"github.com/milvus-io/milvus/pkg/log"
|
||||||
"github.com/milvus-io/milvus/pkg/metrics"
|
"github.com/milvus-io/milvus/pkg/metrics"
|
||||||
@ -86,8 +88,8 @@ func AuthenticationInterceptor(ctx context.Context) (context.Context, error) {
|
|||||||
// username+password authentication
|
// username+password authentication
|
||||||
username, password := parseMD(rawToken)
|
username, password := parseMD(rawToken)
|
||||||
if !passwordVerify(ctx, username, password, globalMetaCache) {
|
if !passwordVerify(ctx, username, password, globalMetaCache) {
|
||||||
msg := fmt.Sprintf("username: %s, password: %s", username, password)
|
// NOTE: don't use the merr, because it will cause the wrong retry behavior in the sdk
|
||||||
return nil, merr.WrapErrParameterInvalid("vaild username and password", msg, "auth check failure, please check username and password are correct")
|
return nil, status.Errorf(codes.Unauthenticated, "auth check failure, please check username [%s] and password [%s] are correct", username, password)
|
||||||
}
|
}
|
||||||
metrics.UserRPCCounter.WithLabelValues(username).Inc()
|
metrics.UserRPCCounter.WithLabelValues(username).Inc()
|
||||||
}
|
}
|
||||||
|
|||||||
@ -63,7 +63,9 @@ func TestResourceManager(t *testing.T) {
|
|||||||
assert.Equal(t, "foo2", res.Get())
|
assert.Equal(t, "foo2", res.Get())
|
||||||
res = manager.Delete("test", "foo")
|
res = manager.Delete("test", "foo")
|
||||||
assert.Equal(t, "foo2", res.Get())
|
assert.Equal(t, "foo2", res.Get())
|
||||||
time.Sleep(time.Second)
|
assert.Eventually(t, func() bool {
|
||||||
|
return manager.Delete("test", "foo") == nil
|
||||||
|
}, time.Second*5, time.Millisecond*500)
|
||||||
|
|
||||||
res, err := manager.Get("test", "foo", func() (Resource, error) {
|
res, err := manager.Get("test", "foo", func() (Resource, error) {
|
||||||
return NewSimpleResource("foo3", "test", "foo", 0, nil), nil
|
return NewSimpleResource("foo3", "test", "foo", 0, nil), nil
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user