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:
Aaron Craelius
2020-06-08 13:41:30 +00:00
committed by GitHub
co-authored by Alexander Bezobchuk Federico Kunze
parent c44813bcdf
commit 4e0a475751
6 changed files with 87 additions and 18 deletions
+1 -1
View File
@@ -1555,7 +1555,7 @@ func TestGRPCQuery(t *testing.T) {
grpcQueryOpt := func(bapp *BaseApp) {
testdata.RegisterTestServiceServer(
bapp.GRPCQueryRouter(),
testServer{},
testdata.TestServiceImpl{},
)
}
+1 -15
View File
@@ -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{},