mirror of
https://github.com/go-kratos/kratos.git
synced 2025-01-07 23:02:12 +02:00
fix test
This commit is contained in:
parent
24a710968b
commit
40f5515e85
@ -156,6 +156,7 @@ func NewConn(target string, opt ...grpc.DialOption) (*grpc.ClientConn, error) {
|
||||
// NewClient returns a new blank Client instance with a default client interceptor.
|
||||
// opt can be used to add grpc dial options.
|
||||
func NewClient(conf *ClientConfig, opt ...grpc.DialOption) *Client {
|
||||
// Do not initialize in the registration, otherwise it may cause the resvoler in the business code to not register.
|
||||
resolver.Register(direct.New())
|
||||
c := new(Client)
|
||||
if err := c.SetConfig(conf); err != nil {
|
||||
@ -170,6 +171,7 @@ func NewClient(conf *ClientConfig, opt ...grpc.DialOption) *Client {
|
||||
// DefaultClient returns a new default Client instance with a default client interceptor and default dialoption.
|
||||
// opt can be used to add grpc dial options.
|
||||
func DefaultClient() *Client {
|
||||
// Do not initialize in the registration, otherwise it may cause the resvoler in the business code to not register.
|
||||
resolver.Register(direct.New())
|
||||
_once.Do(func() {
|
||||
_defaultClient = NewClient(nil)
|
||||
|
@ -11,6 +11,7 @@ import (
|
||||
"github.com/bilibili/kratos/pkg/net/rpc/warden"
|
||||
pb "github.com/bilibili/kratos/pkg/net/rpc/warden/internal/proto/testproto"
|
||||
"github.com/bilibili/kratos/pkg/net/rpc/warden/resolver"
|
||||
"github.com/bilibili/kratos/pkg/net/rpc/warden/resolver/direct"
|
||||
xtime "github.com/bilibili/kratos/pkg/time"
|
||||
)
|
||||
|
||||
@ -39,7 +40,7 @@ func createServer(name, listen string) *warden.Server {
|
||||
}
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
resolver.Register(New())
|
||||
resolver.Register(direct.New())
|
||||
ctx := context.TODO()
|
||||
s1 := createServer("server1", "127.0.0.1:18081")
|
||||
s2 := createServer("server2", "127.0.0.1:18082")
|
Loading…
Reference in New Issue
Block a user