mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Adopt grpc_testing to grpc-1.36.
This commit is contained in:
@@ -22,7 +22,7 @@ import (
|
||||
|
||||
"go.etcd.io/etcd/client/v3/naming/endpoints"
|
||||
"go.etcd.io/etcd/client/v3/naming/resolver"
|
||||
grpctest "go.etcd.io/etcd/pkg/v3/grpc_testing"
|
||||
"go.etcd.io/etcd/pkg/v3/grpc_testing"
|
||||
"go.etcd.io/etcd/tests/v3/integration"
|
||||
|
||||
"google.golang.org/grpc"
|
||||
@@ -35,14 +35,14 @@ func TestEtcdGrpcResolver(t *testing.T) {
|
||||
integration.BeforeTest(t)
|
||||
|
||||
s1PayloadBody := []byte{'1'}
|
||||
s1 := newDummyStubServer(s1PayloadBody)
|
||||
s1 := grpc_testing.NewDummyStubServer(s1PayloadBody)
|
||||
if err := s1.Start(nil); err != nil {
|
||||
t.Fatal("failed to start dummy grpc server (s1)", err)
|
||||
}
|
||||
defer s1.Stop()
|
||||
|
||||
s2PayloadBody := []byte{'2'}
|
||||
s2 := newDummyStubServer(s2PayloadBody)
|
||||
s2 := grpc_testing.NewDummyStubServer(s2PayloadBody)
|
||||
if err := s2.Start(nil); err != nil {
|
||||
t.Fatal("failed to start dummy grpc server (s2)", err)
|
||||
}
|
||||
@@ -112,17 +112,3 @@ func TestEtcdGrpcResolver(t *testing.T) {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
func newDummyStubServer(body []byte) *grpctest.StubServer {
|
||||
testService := &testpb.TestServiceService{
|
||||
UnaryCall: func(ctx context.Context, in *testpb.SimpleRequest) (*testpb.SimpleResponse, error) {
|
||||
return &testpb.SimpleResponse{
|
||||
Payload: &testpb.Payload{
|
||||
Type: testpb.PayloadType_COMPRESSABLE,
|
||||
Body: body,
|
||||
},
|
||||
}, nil
|
||||
},
|
||||
}
|
||||
return grpctest.New(testService)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user