Make client.Context implement gRPC ClientConn (#6342)
* Add QueryConn to client.Context * Add integration test * imports * spelling * Make client.Context implement grpc ClientConn Co-authored-by: Alexander Bezobchuk <alexanderbez@users.noreply.github.com> Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
This commit is contained in:
co-authored by
Alexander Bezobchuk
Federico Kunze
parent
c44813bcdf
commit
4e0a475751
@@ -1555,7 +1555,7 @@ func TestGRPCQuery(t *testing.T) {
|
||||
grpcQueryOpt := func(bapp *BaseApp) {
|
||||
testdata.RegisterTestServiceServer(
|
||||
bapp.GRPCQueryRouter(),
|
||||
testServer{},
|
||||
testdata.TestServiceImpl{},
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ package baseapp
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
@@ -11,22 +10,9 @@ import (
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
)
|
||||
|
||||
type testServer struct{}
|
||||
|
||||
func (e testServer) Echo(_ context.Context, req *testdata.EchoRequest) (*testdata.EchoResponse, error) {
|
||||
return &testdata.EchoResponse{Message: req.Message}, nil
|
||||
}
|
||||
|
||||
func (e testServer) SayHello(_ context.Context, request *testdata.SayHelloRequest) (*testdata.SayHelloResponse, error) {
|
||||
greeting := fmt.Sprintf("Hello %s!", request.Name)
|
||||
return &testdata.SayHelloResponse{Greeting: greeting}, nil
|
||||
}
|
||||
|
||||
var _ testdata.TestServiceServer = testServer{}
|
||||
|
||||
func TestGRPCRouter(t *testing.T) {
|
||||
qr := NewGRPCQueryRouter()
|
||||
testdata.RegisterTestServiceServer(qr, testServer{})
|
||||
testdata.RegisterTestServiceServer(qr, testdata.TestServiceImpl{})
|
||||
helper := &QueryServiceTestHelper{
|
||||
GRPCQueryRouter: qr,
|
||||
ctx: sdk.Context{},
|
||||
|
||||
Reference in New Issue
Block a user