fixup all tests
Some checks failed
test / test (push) Failing after 16s

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
2025-01-18 15:17:58 +03:00
parent 356e20440b
commit 4c0469d1f0
33 changed files with 175 additions and 281 deletions

View File

@@ -17,7 +17,7 @@ type testClient struct {
name string
}
func NewTestClient(name string, c client.Client) proto.TestClient {
func NewTestClient(name string, c client.Client) TestClient {
return &testClient{c: c, name: name}
}
@@ -30,7 +30,7 @@ func (c *testClient) Call(ctx context.Context, req *proto.Request, opts ...clien
return rsp, nil
}
func (c *testClient) Stream(ctx context.Context, opts ...client.CallOption) (proto.Test_StreamClient, error) {
func (c *testClient) Stream(ctx context.Context, opts ...client.CallOption) (Test_StreamClient, error) {
stream, err := c.c.Stream(ctx, c.c.NewRequest(c.name, "Test.Stream", &proto.Request{}), opts...)
if err != nil {
return nil, err
@@ -91,7 +91,7 @@ func (s *testClientStream) Recv() (*proto.Response, error) {
}
type testServer struct {
proto.TestServer
TestServer
}
func (h *testServer) Call(ctx context.Context, req *proto.Request, rsp *proto.Response) error {
@@ -141,7 +141,7 @@ func (s *testStreamStream) Recv() (*proto.Request, error) {
return msg, nil
}
func RegisterTestServer(s server.Server, sh proto.TestServer, opts ...server.HandlerOption) error {
func RegisterTestServer(s server.Server, sh TestServer, opts ...server.HandlerOption) error {
type test interface {
Call(ctx context.Context, req *proto.Request, rsp *proto.Response) error
Stream(ctx context.Context, stream server.Stream) error

View File

@@ -15,6 +15,7 @@ import (
"go.unistack.org/micro/v3/client"
"go.unistack.org/micro/v3/errors"
"go.unistack.org/micro/v3/register"
mregister "go.unistack.org/micro/v3/register/memory"
"go.unistack.org/micro/v3/router"
pgrpc "google.golang.org/grpc"
"google.golang.org/grpc/codes"
@@ -71,7 +72,7 @@ func TestGRPCClient(t *testing.T) {
defer s.Stop()
// create mock register
r := register.NewRegister()
r := mregister.NewRegister()
// register service
if err := r.Register(ctx, &register.Service{

View File

@@ -18,6 +18,7 @@ import (
"go.unistack.org/micro/v3/client"
"go.unistack.org/micro/v3/codec"
"go.unistack.org/micro/v3/register"
mregister "go.unistack.org/micro/v3/register/memory"
"go.unistack.org/micro/v3/router"
"google.golang.org/protobuf/types/known/wrapperspb"
)
@@ -89,7 +90,7 @@ func TestNativeWithoutPath(t *testing.T) {
}
func TestHTTPClient(t *testing.T) {
reg := register.NewRegister()
reg := mregister.NewRegister()
rtr := rrouter.NewRouter(router.Register(reg))
ctx, cancel := context.WithCancel(context.Background())
@@ -179,7 +180,7 @@ func TestHTTPClient(t *testing.T) {
}
func TestHTTPClientStream(t *testing.T) {
reg := register.NewRegister()
reg := mregister.NewRegister()
rtr := rrouter.NewRouter(router.Register(reg))
ctx, cancel := context.WithCancel(context.Background())