testing: delete internal copy of test service proto, and use canonical one (#6164)

This commit is contained in:
Easwar Swaminathan 2023-04-05 17:12:57 -07:00 committed by GitHub
parent 10401b9289
commit bfb57b8b49
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
68 changed files with 2621 additions and 2136 deletions

View File

@ -36,23 +36,25 @@ import (
"google.golang.org/grpc/internal/grpctest"
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/status"
pb "google.golang.org/grpc/test/grpc_testing"
"google.golang.org/grpc/testdata"
testgrpc "google.golang.org/grpc/interop/grpc_testing"
testpb "google.golang.org/grpc/interop/grpc_testing"
)
type testServer struct {
pb.UnimplementedTestServiceServer
testgrpc.UnimplementedTestServiceServer
}
func (s *testServer) UnaryCall(ctx context.Context, req *pb.SimpleRequest) (*pb.SimpleResponse, error) {
return &pb.SimpleResponse{}, nil
func (s *testServer) UnaryCall(ctx context.Context, req *testpb.SimpleRequest) (*testpb.SimpleResponse, error) {
return &testpb.SimpleResponse{}, nil
}
func (s *testServer) StreamingInputCall(stream pb.TestService_StreamingInputCallServer) error {
func (s *testServer) StreamingInputCall(stream testgrpc.TestService_StreamingInputCallServer) error {
for {
_, err := stream.Recv()
if err == io.EOF {
return stream.SendAndClose(&pb.StreamingInputCallResponse{})
return stream.SendAndClose(&testpb.StreamingInputCallResponse{})
}
if err != nil {
return err
@ -315,7 +317,7 @@ func (s) TestStaticPolicyEnd2End(t *testing.T) {
grpc.ChainUnaryInterceptor(i.UnaryInterceptor),
grpc.ChainStreamInterceptor(i.StreamInterceptor))
defer s.Stop()
pb.RegisterTestServiceServer(s, &testServer{})
testgrpc.RegisterTestServiceServer(s, &testServer{})
lis, err := net.Listen("tcp", "localhost:0")
if err != nil {
@ -329,14 +331,14 @@ func (s) TestStaticPolicyEnd2End(t *testing.T) {
t.Fatalf("grpc.Dial(%v) failed: %v", lis.Addr().String(), err)
}
defer clientConn.Close()
client := pb.NewTestServiceClient(clientConn)
client := testgrpc.NewTestServiceClient(clientConn)
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
ctx = metadata.NewOutgoingContext(ctx, test.md)
// Verifying authorization decision for Unary RPC.
_, err = client.UnaryCall(ctx, &pb.SimpleRequest{})
_, err = client.UnaryCall(ctx, &testpb.SimpleRequest{})
if got := status.Convert(err); got.Code() != test.wantStatus.Code() || got.Message() != test.wantStatus.Message() {
t.Fatalf("[UnaryCall] error want:{%v} got:{%v}", test.wantStatus.Err(), got.Err())
}
@ -346,8 +348,8 @@ func (s) TestStaticPolicyEnd2End(t *testing.T) {
if err != nil {
t.Fatalf("failed StreamingInputCall err: %v", err)
}
req := &pb.StreamingInputCallRequest{
Payload: &pb.Payload{
req := &testpb.StreamingInputCallRequest{
Payload: &testpb.Payload{
Body: []byte("hi"),
},
}
@ -385,7 +387,7 @@ func (s) TestAllowsRPCRequestWithPrincipalsFieldOnTLSAuthenticatedConnection(t *
grpc.Creds(creds),
grpc.ChainUnaryInterceptor(i.UnaryInterceptor))
defer s.Stop()
pb.RegisterTestServiceServer(s, &testServer{})
testgrpc.RegisterTestServiceServer(s, &testServer{})
lis, err := net.Listen("tcp", "localhost:0")
if err != nil {
@ -403,13 +405,13 @@ func (s) TestAllowsRPCRequestWithPrincipalsFieldOnTLSAuthenticatedConnection(t *
t.Fatalf("grpc.Dial(%v) failed: %v", lis.Addr().String(), err)
}
defer clientConn.Close()
client := pb.NewTestServiceClient(clientConn)
client := testgrpc.NewTestServiceClient(clientConn)
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
// Verifying authorization decision.
if _, err = client.UnaryCall(ctx, &pb.SimpleRequest{}); err != nil {
if _, err = client.UnaryCall(ctx, &testpb.SimpleRequest{}); err != nil {
t.Fatalf("client.UnaryCall(_, _) = %v; want nil", err)
}
}
@ -450,7 +452,7 @@ func (s) TestAllowsRPCRequestWithPrincipalsFieldOnMTLSAuthenticatedConnection(t
grpc.Creds(creds),
grpc.ChainUnaryInterceptor(i.UnaryInterceptor))
defer s.Stop()
pb.RegisterTestServiceServer(s, &testServer{})
testgrpc.RegisterTestServiceServer(s, &testServer{})
lis, err := net.Listen("tcp", "localhost:0")
if err != nil {
@ -481,13 +483,13 @@ func (s) TestAllowsRPCRequestWithPrincipalsFieldOnMTLSAuthenticatedConnection(t
t.Fatalf("grpc.Dial(%v) failed: %v", lis.Addr().String(), err)
}
defer clientConn.Close()
client := pb.NewTestServiceClient(clientConn)
client := testgrpc.NewTestServiceClient(clientConn)
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
// Verifying authorization decision.
if _, err = client.UnaryCall(ctx, &pb.SimpleRequest{}); err != nil {
if _, err = client.UnaryCall(ctx, &testpb.SimpleRequest{}); err != nil {
t.Fatalf("client.UnaryCall(_, _) = %v; want nil", err)
}
}
@ -504,7 +506,7 @@ func (s) TestFileWatcherEnd2End(t *testing.T) {
grpc.ChainUnaryInterceptor(i.UnaryInterceptor),
grpc.ChainStreamInterceptor(i.StreamInterceptor))
defer s.Stop()
pb.RegisterTestServiceServer(s, &testServer{})
testgrpc.RegisterTestServiceServer(s, &testServer{})
lis, err := net.Listen("tcp", "localhost:0")
if err != nil {
@ -519,14 +521,14 @@ func (s) TestFileWatcherEnd2End(t *testing.T) {
t.Fatalf("grpc.Dial(%v) failed: %v", lis.Addr().String(), err)
}
defer clientConn.Close()
client := pb.NewTestServiceClient(clientConn)
client := testgrpc.NewTestServiceClient(clientConn)
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
ctx = metadata.NewOutgoingContext(ctx, test.md)
// Verifying authorization decision for Unary RPC.
_, err = client.UnaryCall(ctx, &pb.SimpleRequest{})
_, err = client.UnaryCall(ctx, &testpb.SimpleRequest{})
if got := status.Convert(err); got.Code() != test.wantStatus.Code() || got.Message() != test.wantStatus.Message() {
t.Fatalf("[UnaryCall] error want:{%v} got:{%v}", test.wantStatus.Err(), got.Err())
}
@ -536,8 +538,8 @@ func (s) TestFileWatcherEnd2End(t *testing.T) {
if err != nil {
t.Fatalf("failed StreamingInputCall err: %v", err)
}
req := &pb.StreamingInputCallRequest{
Payload: &pb.Payload{
req := &testpb.StreamingInputCallRequest{
Payload: &testpb.Payload{
Body: []byte("hi"),
},
}
@ -552,9 +554,9 @@ func (s) TestFileWatcherEnd2End(t *testing.T) {
}
}
func retryUntil(ctx context.Context, tsc pb.TestServiceClient, want *status.Status) (lastErr error) {
func retryUntil(ctx context.Context, tsc testgrpc.TestServiceClient, want *status.Status) (lastErr error) {
for ctx.Err() == nil {
_, lastErr = tsc.UnaryCall(ctx, &pb.SimpleRequest{})
_, lastErr = tsc.UnaryCall(ctx, &testpb.SimpleRequest{})
if s := status.Convert(lastErr); s.Code() == want.Code() && s.Message() == want.Message() {
return nil
}
@ -573,7 +575,7 @@ func (s) TestFileWatcher_ValidPolicyRefresh(t *testing.T) {
s := grpc.NewServer(
grpc.ChainUnaryInterceptor(i.UnaryInterceptor))
defer s.Stop()
pb.RegisterTestServiceServer(s, &testServer{})
testgrpc.RegisterTestServiceServer(s, &testServer{})
lis, err := net.Listen("tcp", "localhost:0")
if err != nil {
@ -588,13 +590,13 @@ func (s) TestFileWatcher_ValidPolicyRefresh(t *testing.T) {
t.Fatalf("grpc.Dial(%v) failed: %v", lis.Addr().String(), err)
}
defer clientConn.Close()
client := pb.NewTestServiceClient(clientConn)
client := testgrpc.NewTestServiceClient(clientConn)
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
// Verifying authorization decision.
_, err = client.UnaryCall(ctx, &pb.SimpleRequest{})
_, err = client.UnaryCall(ctx, &testpb.SimpleRequest{})
if got := status.Convert(err); got.Code() != valid1.wantStatus.Code() || got.Message() != valid1.wantStatus.Message() {
t.Fatalf("client.UnaryCall(_, _) = %v; want = %v", got.Err(), valid1.wantStatus.Err())
}
@ -621,7 +623,7 @@ func (s) TestFileWatcher_InvalidPolicySkipReload(t *testing.T) {
s := grpc.NewServer(
grpc.ChainUnaryInterceptor(i.UnaryInterceptor))
defer s.Stop()
pb.RegisterTestServiceServer(s, &testServer{})
testgrpc.RegisterTestServiceServer(s, &testServer{})
lis, err := net.Listen("tcp", "localhost:0")
if err != nil {
@ -636,13 +638,13 @@ func (s) TestFileWatcher_InvalidPolicySkipReload(t *testing.T) {
t.Fatalf("grpc.Dial(%v) failed: %v", lis.Addr().String(), err)
}
defer clientConn.Close()
client := pb.NewTestServiceClient(clientConn)
client := testgrpc.NewTestServiceClient(clientConn)
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
// Verifying authorization decision.
_, err = client.UnaryCall(ctx, &pb.SimpleRequest{})
_, err = client.UnaryCall(ctx, &testpb.SimpleRequest{})
if got := status.Convert(err); got.Code() != valid.wantStatus.Code() || got.Message() != valid.wantStatus.Message() {
t.Fatalf("client.UnaryCall(_, _) = %v; want = %v", got.Err(), valid.wantStatus.Err())
}
@ -656,7 +658,7 @@ func (s) TestFileWatcher_InvalidPolicySkipReload(t *testing.T) {
time.Sleep(40 * time.Millisecond)
// Verifying authorization decision.
_, err = client.UnaryCall(ctx, &pb.SimpleRequest{})
_, err = client.UnaryCall(ctx, &testpb.SimpleRequest{})
if got := status.Convert(err); got.Code() != valid.wantStatus.Code() || got.Message() != valid.wantStatus.Message() {
t.Fatalf("client.UnaryCall(_, _) = %v; want = %v", got.Err(), valid.wantStatus.Err())
}
@ -672,7 +674,7 @@ func (s) TestFileWatcher_RecoversFromReloadFailure(t *testing.T) {
s := grpc.NewServer(
grpc.ChainUnaryInterceptor(i.UnaryInterceptor))
defer s.Stop()
pb.RegisterTestServiceServer(s, &testServer{})
testgrpc.RegisterTestServiceServer(s, &testServer{})
lis, err := net.Listen("tcp", "localhost:0")
if err != nil {
@ -687,13 +689,13 @@ func (s) TestFileWatcher_RecoversFromReloadFailure(t *testing.T) {
t.Fatalf("grpc.Dial(%v) failed: %v", lis.Addr().String(), err)
}
defer clientConn.Close()
client := pb.NewTestServiceClient(clientConn)
client := testgrpc.NewTestServiceClient(clientConn)
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
// Verifying authorization decision.
_, err = client.UnaryCall(ctx, &pb.SimpleRequest{})
_, err = client.UnaryCall(ctx, &testpb.SimpleRequest{})
if got := status.Convert(err); got.Code() != valid1.wantStatus.Code() || got.Message() != valid1.wantStatus.Message() {
t.Fatalf("client.UnaryCall(_, _) = %v; want = %v", got.Err(), valid1.wantStatus.Err())
}
@ -707,7 +709,7 @@ func (s) TestFileWatcher_RecoversFromReloadFailure(t *testing.T) {
time.Sleep(120 * time.Millisecond)
// Verifying authorization decision.
_, err = client.UnaryCall(ctx, &pb.SimpleRequest{})
_, err = client.UnaryCall(ctx, &testpb.SimpleRequest{})
if got := status.Convert(err); got.Code() != valid1.wantStatus.Code() || got.Message() != valid1.wantStatus.Message() {
t.Fatalf("client.UnaryCall(_, _) = %v; want = %v", got.Err(), valid1.wantStatus.Err())
}

View File

@ -54,7 +54,8 @@ import (
durationpb "github.com/golang/protobuf/ptypes/duration"
lbgrpc "google.golang.org/grpc/balancer/grpclb/grpc_lb_v1"
lbpb "google.golang.org/grpc/balancer/grpclb/grpc_lb_v1"
testpb "google.golang.org/grpc/test/grpc_testing"
testgrpc "google.golang.org/grpc/interop/grpc_testing"
testpb "google.golang.org/grpc/interop/grpc_testing"
)
var (
@ -298,7 +299,7 @@ func (b *remoteBalancer) BalanceLoad(stream lbgrpc.LoadBalancer_BalanceLoadServe
}
type testServer struct {
testpb.UnimplementedTestServiceServer
testgrpc.UnimplementedTestServiceServer
addr string
fallback bool
@ -318,7 +319,7 @@ func (s *testServer) EmptyCall(ctx context.Context, in *testpb.Empty) (*testpb.E
return &testpb.Empty{}, nil
}
func (s *testServer) FullDuplexCall(stream testpb.TestService_FullDuplexCallServer) error {
func (s *testServer) FullDuplexCall(stream testgrpc.TestService_FullDuplexCallServer) error {
return nil
}
@ -328,7 +329,7 @@ func startBackends(t *testing.T, sn string, fallback bool, lis ...net.Listener)
sn: sn,
}
s := grpc.NewServer(grpc.Creds(creds))
testpb.RegisterTestServiceServer(s, &testServer{addr: l.Addr().String(), fallback: fallback})
testgrpc.RegisterTestServiceServer(s, &testServer{addr: l.Addr().String(), fallback: fallback})
servers = append(servers, s)
go func(s *grpc.Server, l net.Listener) {
s.Serve(l)
@ -466,7 +467,7 @@ func (s) TestGRPCLB_Basic(t *testing.T) {
// Make one successful RPC.
ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
defer cancel()
testC := testpb.NewTestServiceClient(cc)
testC := testgrpc.NewTestServiceClient(cc)
if _, err := testC.EmptyCall(ctx, &testpb.Empty{}); err != nil {
t.Fatalf("%v.EmptyCall(_, _) = _, %v, want _, <nil>", testC, err)
}
@ -539,7 +540,7 @@ func (s) TestGRPCLB_Weighted(t *testing.T) {
}
tss.ls.sls <- &lbpb.ServerList{Servers: backends}
testC := testpb.NewTestServiceClient(cc)
testC := testgrpc.NewTestServiceClient(cc)
if err := roundrobin.CheckWeightedRoundRobinRPCs(ctx, testC, wantAddrs); err != nil {
t.Fatal(err)
}
@ -599,7 +600,7 @@ func (s) TestGRPCLB_DropRequest(t *testing.T) {
t.Fatalf("Failed to dial to the backend %v", err)
}
defer cc.Close()
testC := testpb.NewTestServiceClient(cc)
testC := testgrpc.NewTestServiceClient(cc)
var (
i int
@ -771,7 +772,7 @@ func (s) TestGRPCLB_BalancerDisconnects(t *testing.T) {
t.Fatalf("Failed to dial to the backend %v", err)
}
defer cc.Close()
testC := testpb.NewTestServiceClient(cc)
testC := testgrpc.NewTestServiceClient(cc)
ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
defer cancel()
@ -836,7 +837,7 @@ func (s) TestGRPCLB_Fallback(t *testing.T) {
t.Fatalf("Failed to dial to the backend %v", err)
}
defer cc.Close()
testC := testpb.NewTestServiceClient(cc)
testC := testgrpc.NewTestServiceClient(cc)
// Push an update to the resolver with fallback backend address stored in
// the `Addresses` field and an invalid remote balancer address stored in
@ -942,7 +943,7 @@ func (s) TestGRPCLB_ExplicitFallback(t *testing.T) {
t.Fatalf("Failed to dial to the backend %v", err)
}
defer cc.Close()
testC := testpb.NewTestServiceClient(cc)
testC := testgrpc.NewTestServiceClient(cc)
ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
defer cancel()
@ -1012,7 +1013,7 @@ func (s) TestGRPCLB_FallBackWithNoServerAddress(t *testing.T) {
t.Fatalf("Failed to dial to the backend %v", err)
}
defer cc.Close()
testC := testpb.NewTestServiceClient(cc)
testC := testgrpc.NewTestServiceClient(cc)
ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
defer cancel()
@ -1151,7 +1152,7 @@ func (s) TestGRPCLB_PickFirst(t *testing.T) {
}
rs = grpclbstate.Set(resolver.State{ServiceConfig: r.CC.ParseServiceConfig(grpclbConfig)}, s)
r.UpdateState(rs)
testC := testpb.NewTestServiceClient(cc)
testC := testgrpc.NewTestServiceClient(cc)
if err := roundrobin.CheckRoundRobinRPCs(ctx, testC, beServerAddrs[1:]); err != nil {
t.Fatal(err)
}
@ -1194,7 +1195,7 @@ func (s) TestGRPCLB_BackendConnectionErrorPropagation(t *testing.T) {
t.Fatalf("Failed to dial to the backend %v", err)
}
defer cc.Close()
testC := testpb.NewTestServiceClient(cc)
testC := testgrpc.NewTestServiceClient(cc)
rs := resolver.State{
Addresses: []resolver.Address{{Addr: beLis.Addr().String()}},
@ -1246,7 +1247,7 @@ func testGRPCLBEmptyServerList(t *testing.T, svcfg string) {
t.Fatalf("Failed to dial to the backend %v", err)
}
defer cc.Close()
testC := testpb.NewTestServiceClient(cc)
testC := testgrpc.NewTestServiceClient(cc)
tss.ls.sls <- &lbpb.ServerList{Servers: beServers}
@ -1320,7 +1321,7 @@ func (s) TestGRPCLBWithTargetNameFieldInConfig(t *testing.T) {
t.Fatalf("Failed to dial to the backend %v", err)
}
defer cc.Close()
testC := testpb.NewTestServiceClient(cc)
testC := testgrpc.NewTestServiceClient(cc)
// Push a resolver update with grpclb configuration which does not contain the
// target_name field. Our fake remote balancer is configured to always
@ -1453,7 +1454,7 @@ const (
func (s) TestGRPCLBStatsUnarySuccess(t *testing.T) {
if err := runAndCheckStats(t, false, nil, func(cc *grpc.ClientConn) {
testC := testpb.NewTestServiceClient(cc)
testC := testgrpc.NewTestServiceClient(cc)
ctx, cancel := context.WithTimeout(context.Background(), defaultFallbackTimeout)
defer cancel()
// The first non-failfast RPC succeeds, all connections are up.
@ -1474,7 +1475,7 @@ func (s) TestGRPCLBStatsUnarySuccess(t *testing.T) {
func (s) TestGRPCLBStatsUnaryDrop(t *testing.T) {
if err := runAndCheckStats(t, true, nil, func(cc *grpc.ClientConn) {
testC := testpb.NewTestServiceClient(cc)
testC := testgrpc.NewTestServiceClient(cc)
ctx, cancel := context.WithTimeout(context.Background(), defaultFallbackTimeout)
defer cancel()
// The first non-failfast RPC succeeds, all connections are up.
@ -1496,7 +1497,7 @@ func (s) TestGRPCLBStatsUnaryDrop(t *testing.T) {
func (s) TestGRPCLBStatsUnaryFailedToSend(t *testing.T) {
if err := runAndCheckStats(t, false, nil, func(cc *grpc.ClientConn) {
testC := testpb.NewTestServiceClient(cc)
testC := testgrpc.NewTestServiceClient(cc)
ctx, cancel := context.WithTimeout(context.Background(), defaultFallbackTimeout)
defer cancel()
// The first non-failfast RPC succeeds, all connections are up.
@ -1518,7 +1519,7 @@ func (s) TestGRPCLBStatsUnaryFailedToSend(t *testing.T) {
func (s) TestGRPCLBStatsStreamingSuccess(t *testing.T) {
if err := runAndCheckStats(t, false, nil, func(cc *grpc.ClientConn) {
testC := testpb.NewTestServiceClient(cc)
testC := testgrpc.NewTestServiceClient(cc)
ctx, cancel := context.WithTimeout(context.Background(), defaultFallbackTimeout)
defer cancel()
// The first non-failfast RPC succeeds, all connections are up.
@ -1553,7 +1554,7 @@ func (s) TestGRPCLBStatsStreamingSuccess(t *testing.T) {
func (s) TestGRPCLBStatsStreamingDrop(t *testing.T) {
if err := runAndCheckStats(t, true, nil, func(cc *grpc.ClientConn) {
testC := testpb.NewTestServiceClient(cc)
testC := testgrpc.NewTestServiceClient(cc)
ctx, cancel := context.WithTimeout(context.Background(), defaultFallbackTimeout)
defer cancel()
// The first non-failfast RPC succeeds, all connections are up.
@ -1589,7 +1590,7 @@ func (s) TestGRPCLBStatsStreamingDrop(t *testing.T) {
func (s) TestGRPCLBStatsStreamingFailedToSend(t *testing.T) {
if err := runAndCheckStats(t, false, nil, func(cc *grpc.ClientConn) {
testC := testpb.NewTestServiceClient(cc)
testC := testgrpc.NewTestServiceClient(cc)
ctx, cancel := context.WithTimeout(context.Background(), defaultFallbackTimeout)
defer cancel()
// The first non-failfast RPC succeeds, all connections are up.

View File

@ -34,12 +34,12 @@ import (
rlspb "google.golang.org/grpc/internal/proto/grpc_lookup_v1"
internalserviceconfig "google.golang.org/grpc/internal/serviceconfig"
"google.golang.org/grpc/internal/stubserver"
testgrpc "google.golang.org/grpc/interop/grpc_testing"
testpb "google.golang.org/grpc/interop/grpc_testing"
"google.golang.org/grpc/resolver"
"google.golang.org/grpc/resolver/manual"
"google.golang.org/grpc/serviceconfig"
"google.golang.org/grpc/status"
testgrpc "google.golang.org/grpc/test/grpc_testing"
testpb "google.golang.org/grpc/test/grpc_testing"
"google.golang.org/protobuf/types/known/durationpb"
)

View File

@ -35,8 +35,8 @@ import (
"google.golang.org/protobuf/types/known/durationpb"
rlspb "google.golang.org/grpc/internal/proto/grpc_lookup_v1"
testgrpc "google.golang.org/grpc/test/grpc_testing"
testpb "google.golang.org/grpc/test/grpc_testing"
testgrpc "google.golang.org/grpc/interop/grpc_testing"
testpb "google.golang.org/grpc/interop/grpc_testing"
)
// Test verifies the scenario where there is no matching entry in the data cache

View File

@ -3,22 +3,22 @@ module google.golang.org/grpc/gcp/observability
go 1.17
require (
cloud.google.com/go/logging v1.6.1
cloud.google.com/go/logging v1.7.0
contrib.go.opencensus.io/exporter/stackdriver v0.13.12
github.com/google/go-cmp v0.5.9
github.com/google/uuid v1.3.0
go.opencensus.io v0.24.0
golang.org/x/oauth2 v0.5.0
google.golang.org/api v0.109.0
google.golang.org/grpc v1.53.0-dev.0.20230315171901-a1e657ce53ba
golang.org/x/oauth2 v0.6.0
google.golang.org/api v0.110.0
google.golang.org/grpc v1.53.0
google.golang.org/grpc/stats/opencensus v0.0.0-20230330193705-4a12595692ae
)
require (
cloud.google.com/go v0.109.0 // indirect
cloud.google.com/go v0.110.0 // indirect
cloud.google.com/go/compute v1.18.0 // indirect
cloud.google.com/go/compute/metadata v0.2.3 // indirect
cloud.google.com/go/longrunning v0.4.0 // indirect
cloud.google.com/go/longrunning v0.4.1 // indirect
cloud.google.com/go/monitoring v1.12.0 // indirect
cloud.google.com/go/trace v1.8.0 // indirect
github.com/aws/aws-sdk-go v1.44.162 // indirect
@ -34,8 +34,10 @@ require (
golang.org/x/sys v0.6.0 // indirect
golang.org/x/text v0.8.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20230125152338-dcaf20b6aeaa // indirect
google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 // indirect
google.golang.org/protobuf v1.30.0 // indirect
)
replace google.golang.org/grpc => ../..
replace google.golang.org/grpc/stats/opencensus => ../../stats/opencensus

File diff suppressed because it is too large Load Diff

View File

@ -31,11 +31,13 @@ import (
gcplogging "cloud.google.com/go/logging"
"github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts"
binlogpb "google.golang.org/grpc/binarylog/grpc_binarylog_v1"
"google.golang.org/grpc/internal/envconfig"
"google.golang.org/grpc/internal/stubserver"
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/test/grpc_testing"
binlogpb "google.golang.org/grpc/binarylog/grpc_binarylog_v1"
testgrpc "google.golang.org/grpc/interop/grpc_testing"
testpb "google.golang.org/grpc/interop/grpc_testing"
)
func cmpLoggingEntryList(got []*grpcLogEntry, want []*grpcLogEntry) error {
@ -155,14 +157,14 @@ func (s) TestClientRPCEventsLogAll(t *testing.T) {
defer cleanup()
ss := &stubserver.StubServer{
UnaryCallF: func(ctx context.Context, in *grpc_testing.SimpleRequest) (*grpc_testing.SimpleResponse, error) {
return &grpc_testing.SimpleResponse{}, nil
UnaryCallF: func(ctx context.Context, in *testpb.SimpleRequest) (*testpb.SimpleResponse, error) {
return &testpb.SimpleResponse{}, nil
},
FullDuplexCallF: func(stream grpc_testing.TestService_FullDuplexCallServer) error {
FullDuplexCallF: func(stream testgrpc.TestService_FullDuplexCallServer) error {
if _, err := stream.Recv(); err != nil {
return err
}
if err := stream.Send(&grpc_testing.StreamingOutputCallResponse{}); err != nil {
if err := stream.Send(&testpb.StreamingOutputCallResponse{}); err != nil {
return err
}
if _, err := stream.Recv(); err != io.EOF {
@ -178,7 +180,7 @@ func (s) TestClientRPCEventsLogAll(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
defer cancel()
if _, err := ss.Client.UnaryCall(ctx, &grpc_testing.SimpleRequest{}); err != nil {
if _, err := ss.Client.UnaryCall(ctx, &testpb.SimpleRequest{}); err != nil {
t.Fatalf("Unexpected error from UnaryCall: %v", err)
}
@ -251,7 +253,7 @@ func (s) TestClientRPCEventsLogAll(t *testing.T) {
if err != nil {
t.Fatalf("ss.Client.FullDuplexCall failed: %f", err)
}
if err := stream.Send(&grpc_testing.StreamingOutputCallRequest{}); err != nil {
if err := stream.Send(&testpb.StreamingOutputCallRequest{}); err != nil {
t.Fatalf("stream.Send() failed: %v", err)
}
if _, err := stream.Recv(); err != nil {
@ -365,14 +367,14 @@ func (s) TestServerRPCEventsLogAll(t *testing.T) {
defer cleanup()
ss := &stubserver.StubServer{
UnaryCallF: func(ctx context.Context, in *grpc_testing.SimpleRequest) (*grpc_testing.SimpleResponse, error) {
return &grpc_testing.SimpleResponse{}, nil
UnaryCallF: func(ctx context.Context, in *testpb.SimpleRequest) (*testpb.SimpleResponse, error) {
return &testpb.SimpleResponse{}, nil
},
FullDuplexCallF: func(stream grpc_testing.TestService_FullDuplexCallServer) error {
FullDuplexCallF: func(stream testgrpc.TestService_FullDuplexCallServer) error {
if _, err := stream.Recv(); err != nil {
return err
}
if err := stream.Send(&grpc_testing.StreamingOutputCallResponse{}); err != nil {
if err := stream.Send(&testpb.StreamingOutputCallResponse{}); err != nil {
return err
}
if _, err := stream.Recv(); err != io.EOF {
@ -388,7 +390,7 @@ func (s) TestServerRPCEventsLogAll(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
defer cancel()
if _, err := ss.Client.UnaryCall(ctx, &grpc_testing.SimpleRequest{}); err != nil {
if _, err := ss.Client.UnaryCall(ctx, &testpb.SimpleRequest{}); err != nil {
t.Fatalf("Unexpected error from UnaryCall: %v", err)
}
grpcLogEntriesWant := []*grpcLogEntry{
@ -458,7 +460,7 @@ func (s) TestServerRPCEventsLogAll(t *testing.T) {
if err != nil {
t.Fatalf("ss.Client.FullDuplexCall failed: %f", err)
}
if err := stream.Send(&grpc_testing.StreamingOutputCallRequest{}); err != nil {
if err := stream.Send(&testpb.StreamingOutputCallRequest{}); err != nil {
t.Fatalf("stream.Send() failed: %v", err)
}
if _, err := stream.Recv(); err != nil {
@ -587,10 +589,10 @@ func (s) TestBothClientAndServerRPCEvents(t *testing.T) {
defer cleanup()
ss := &stubserver.StubServer{
UnaryCallF: func(ctx context.Context, in *grpc_testing.SimpleRequest) (*grpc_testing.SimpleResponse, error) {
return &grpc_testing.SimpleResponse{}, nil
UnaryCallF: func(ctx context.Context, in *testpb.SimpleRequest) (*testpb.SimpleResponse, error) {
return &testpb.SimpleResponse{}, nil
},
FullDuplexCallF: func(stream grpc_testing.TestService_FullDuplexCallServer) error {
FullDuplexCallF: func(stream testgrpc.TestService_FullDuplexCallServer) error {
_, err := stream.Recv()
if err != io.EOF {
return err
@ -609,7 +611,7 @@ func (s) TestBothClientAndServerRPCEvents(t *testing.T) {
// entries is checked in previous tests).
ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
defer cancel()
if _, err := ss.Client.UnaryCall(ctx, &grpc_testing.SimpleRequest{}); err != nil {
if _, err := ss.Client.UnaryCall(ctx, &testpb.SimpleRequest{}); err != nil {
t.Fatalf("Unexpected error from UnaryCall: %v", err)
}
fle.mu.Lock()
@ -671,8 +673,8 @@ func (s) TestClientRPCEventsTruncateHeaderAndMetadata(t *testing.T) {
defer cleanup()
ss := &stubserver.StubServer{
UnaryCallF: func(ctx context.Context, in *grpc_testing.SimpleRequest) (*grpc_testing.SimpleResponse, error) {
return &grpc_testing.SimpleResponse{}, nil
UnaryCallF: func(ctx context.Context, in *testpb.SimpleRequest) (*testpb.SimpleResponse, error) {
return &testpb.SimpleResponse{}, nil
},
}
if err := ss.Start(nil); err != nil {
@ -688,7 +690,7 @@ func (s) TestClientRPCEventsTruncateHeaderAndMetadata(t *testing.T) {
"key2": []string{"value2"},
}
ctx = metadata.NewOutgoingContext(ctx, md)
if _, err := ss.Client.UnaryCall(ctx, &grpc_testing.SimpleRequest{Payload: &grpc_testing.Payload{Body: []byte("00000")}}); err != nil {
if _, err := ss.Client.UnaryCall(ctx, &testpb.SimpleRequest{Payload: &testpb.Payload{Body: []byte("00000")}}); err != nil {
t.Fatalf("Unexpected error from UnaryCall: %v", err)
}
grpcLogEntriesWant := []*grpcLogEntry{
@ -820,13 +822,13 @@ func (s) TestPrecedenceOrderingInConfiguration(t *testing.T) {
defer cleanup()
ss := &stubserver.StubServer{
EmptyCallF: func(ctx context.Context, in *grpc_testing.Empty) (*grpc_testing.Empty, error) {
return &grpc_testing.Empty{}, nil
EmptyCallF: func(ctx context.Context, in *testpb.Empty) (*testpb.Empty, error) {
return &testpb.Empty{}, nil
},
UnaryCallF: func(ctx context.Context, in *grpc_testing.SimpleRequest) (*grpc_testing.SimpleResponse, error) {
return &grpc_testing.SimpleResponse{}, nil
UnaryCallF: func(ctx context.Context, in *testpb.SimpleRequest) (*testpb.SimpleResponse, error) {
return &testpb.SimpleResponse{}, nil
},
FullDuplexCallF: func(stream grpc_testing.TestService_FullDuplexCallServer) error {
FullDuplexCallF: func(stream testgrpc.TestService_FullDuplexCallServer) error {
_, err := stream.Recv()
if err != io.EOF {
return err
@ -845,7 +847,7 @@ func (s) TestPrecedenceOrderingInConfiguration(t *testing.T) {
// future.
ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
defer cancel()
if _, err := ss.Client.UnaryCall(ctx, &grpc_testing.SimpleRequest{}); err != nil {
if _, err := ss.Client.UnaryCall(ctx, &testpb.SimpleRequest{}); err != nil {
t.Fatalf("Unexpected error from UnaryCall: %v", err)
}
grpcLogEntriesWant := []*grpcLogEntry{
@ -914,7 +916,7 @@ func (s) TestPrecedenceOrderingInConfiguration(t *testing.T) {
// A unary empty RPC should match with the second event, which has the exclude
// flag set. Thus, a unary empty RPC should cause no downstream logs.
if _, err := ss.Client.EmptyCall(ctx, &grpc_testing.Empty{}); err != nil {
if _, err := ss.Client.EmptyCall(ctx, &testpb.Empty{}); err != nil {
t.Fatalf("Unexpected error from EmptyCall: %v", err)
}
// The exporter should have received no new log entries due to this call.
@ -1147,8 +1149,8 @@ func (s) TestMetadataTruncationAccountsKey(t *testing.T) {
defer cleanup()
ss := &stubserver.StubServer{
UnaryCallF: func(ctx context.Context, in *grpc_testing.SimpleRequest) (*grpc_testing.SimpleResponse, error) {
return &grpc_testing.SimpleResponse{}, nil
UnaryCallF: func(ctx context.Context, in *testpb.SimpleRequest) (*testpb.SimpleResponse, error) {
return &testpb.SimpleResponse{}, nil
},
}
if err := ss.Start(nil); err != nil {
@ -1165,7 +1167,7 @@ func (s) TestMetadataTruncationAccountsKey(t *testing.T) {
"key": []string{mdValue},
}
ctx = metadata.NewOutgoingContext(ctx, md)
if _, err := ss.Client.UnaryCall(ctx, &grpc_testing.SimpleRequest{Payload: &grpc_testing.Payload{Body: []byte("00000")}}); err != nil {
if _, err := ss.Client.UnaryCall(ctx, &testpb.SimpleRequest{Payload: &testpb.Payload{Body: []byte("00000")}}); err != nil {
t.Fatalf("Unexpected error from UnaryCall: %v", err)
}

View File

@ -40,7 +40,9 @@ import (
"google.golang.org/grpc/internal/stubserver"
"google.golang.org/grpc/internal/testutils"
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/test/grpc_testing"
testgrpc "google.golang.org/grpc/interop/grpc_testing"
testpb "google.golang.org/grpc/interop/grpc_testing"
)
type s struct {
@ -381,10 +383,10 @@ func (s) TestOpenCensusIntegration(t *testing.T) {
defer cleanup()
ss := &stubserver.StubServer{
UnaryCallF: func(ctx context.Context, in *grpc_testing.SimpleRequest) (*grpc_testing.SimpleResponse, error) {
return &grpc_testing.SimpleResponse{}, nil
UnaryCallF: func(ctx context.Context, in *testpb.SimpleRequest) (*testpb.SimpleResponse, error) {
return &testpb.SimpleResponse{}, nil
},
FullDuplexCallF: func(stream grpc_testing.TestService_FullDuplexCallServer) error {
FullDuplexCallF: func(stream testgrpc.TestService_FullDuplexCallServer) error {
for {
_, err := stream.Recv()
if err == io.EOF {
@ -401,7 +403,7 @@ func (s) TestOpenCensusIntegration(t *testing.T) {
for i := 0; i < defaultRequestCount; i++ {
ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
defer cancel()
if _, err := ss.Client.UnaryCall(ctx, &grpc_testing.SimpleRequest{Payload: &grpc_testing.Payload{Body: testOkPayload}}); err != nil {
if _, err := ss.Client.UnaryCall(ctx, &testpb.SimpleRequest{Payload: &testpb.Payload{Body: testOkPayload}}); err != nil {
t.Fatalf("Unexpected error from UnaryCall: %v", err)
}
}
@ -599,10 +601,10 @@ func (s) TestLoggingLinkedWithTraceClientSide(t *testing.T) {
}
defer cleanup()
ss := &stubserver.StubServer{
UnaryCallF: func(ctx context.Context, in *grpc_testing.SimpleRequest) (*grpc_testing.SimpleResponse, error) {
return &grpc_testing.SimpleResponse{}, nil
UnaryCallF: func(ctx context.Context, in *testpb.SimpleRequest) (*testpb.SimpleResponse, error) {
return &testpb.SimpleResponse{}, nil
},
FullDuplexCallF: func(stream grpc_testing.TestService_FullDuplexCallServer) error {
FullDuplexCallF: func(stream testgrpc.TestService_FullDuplexCallServer) error {
_, err := stream.Recv()
if err != io.EOF {
return err
@ -675,7 +677,7 @@ func (s) TestLoggingLinkedWithTraceClientSide(t *testing.T) {
fle.mu.Unlock()
readerErrCh.Send(nil)
}()
if _, err := ss.Client.UnaryCall(ctx, &grpc_testing.SimpleRequest{Payload: &grpc_testing.Payload{Body: testOkPayload}}); err != nil {
if _, err := ss.Client.UnaryCall(ctx, &testpb.SimpleRequest{Payload: &testpb.Payload{Body: testOkPayload}}); err != nil {
t.Fatalf("Unexpected error from UnaryCall: %v", err)
}
unaryDone.Fire()
@ -741,10 +743,10 @@ func (s) TestLoggingLinkedWithTraceServerSide(t *testing.T) {
}
defer cleanup()
ss := &stubserver.StubServer{
UnaryCallF: func(ctx context.Context, in *grpc_testing.SimpleRequest) (*grpc_testing.SimpleResponse, error) {
return &grpc_testing.SimpleResponse{}, nil
UnaryCallF: func(ctx context.Context, in *testpb.SimpleRequest) (*testpb.SimpleResponse, error) {
return &testpb.SimpleResponse{}, nil
},
FullDuplexCallF: func(stream grpc_testing.TestService_FullDuplexCallServer) error {
FullDuplexCallF: func(stream testgrpc.TestService_FullDuplexCallServer) error {
_, err := stream.Recv()
if err != io.EOF {
return err
@ -817,7 +819,7 @@ func (s) TestLoggingLinkedWithTraceServerSide(t *testing.T) {
fle.mu.Unlock()
readerErrCh.Send(nil)
}()
if _, err := ss.Client.UnaryCall(ctx, &grpc_testing.SimpleRequest{Payload: &grpc_testing.Payload{Body: testOkPayload}}); err != nil {
if _, err := ss.Client.UnaryCall(ctx, &testpb.SimpleRequest{Payload: &testpb.Payload{Body: testOkPayload}}); err != nil {
t.Fatalf("Unexpected error from UnaryCall: %v", err)
}
unaryDone.Fire()
@ -892,10 +894,10 @@ func (s) TestLoggingLinkedWithTrace(t *testing.T) {
}
defer cleanup()
ss := &stubserver.StubServer{
UnaryCallF: func(ctx context.Context, in *grpc_testing.SimpleRequest) (*grpc_testing.SimpleResponse, error) {
return &grpc_testing.SimpleResponse{}, nil
UnaryCallF: func(ctx context.Context, in *testpb.SimpleRequest) (*testpb.SimpleResponse, error) {
return &testpb.SimpleResponse{}, nil
},
FullDuplexCallF: func(stream grpc_testing.TestService_FullDuplexCallServer) error {
FullDuplexCallF: func(stream testgrpc.TestService_FullDuplexCallServer) error {
_, err := stream.Recv()
if err != io.EOF {
return err
@ -974,7 +976,7 @@ func (s) TestLoggingLinkedWithTrace(t *testing.T) {
fle.mu.Unlock()
readerErrCh.Send(nil)
}()
if _, err := ss.Client.UnaryCall(ctx, &grpc_testing.SimpleRequest{Payload: &grpc_testing.Payload{Body: testOkPayload}}); err != nil {
if _, err := ss.Client.UnaryCall(ctx, &testpb.SimpleRequest{Payload: &testpb.Payload{Body: testOkPayload}}); err != nil {
t.Fatalf("Unexpected error from UnaryCall: %v", err)
}
unaryDone.Fire()

View File

@ -17,7 +17,7 @@
*/
// Package stubserver is a stubbable implementation of
// google.golang.org/grpc/test/grpc_testing for testing purposes.
// google.golang.org/grpc/interop/grpc_testing for testing purposes.
package stubserver
import (
@ -33,22 +33,23 @@ import (
"google.golang.org/grpc/resolver/manual"
"google.golang.org/grpc/serviceconfig"
testpb "google.golang.org/grpc/test/grpc_testing"
testgrpc "google.golang.org/grpc/interop/grpc_testing"
testpb "google.golang.org/grpc/interop/grpc_testing"
)
// StubServer is a server that is easy to customize within individual test
// cases.
type StubServer struct {
// Guarantees we satisfy this interface; panics if unimplemented methods are called.
testpb.TestServiceServer
testgrpc.TestServiceServer
// Customizable implementations of server handlers.
EmptyCallF func(ctx context.Context, in *testpb.Empty) (*testpb.Empty, error)
UnaryCallF func(ctx context.Context, in *testpb.SimpleRequest) (*testpb.SimpleResponse, error)
FullDuplexCallF func(stream testpb.TestService_FullDuplexCallServer) error
FullDuplexCallF func(stream testgrpc.TestService_FullDuplexCallServer) error
// A client connected to this service the test may use. Created in Start().
Client testpb.TestServiceClient
Client testgrpc.TestServiceClient
CC *grpc.ClientConn
S *grpc.Server
@ -75,7 +76,7 @@ func (ss *StubServer) UnaryCall(ctx context.Context, in *testpb.SimpleRequest) (
}
// FullDuplexCall is the handler for testpb.FullDuplexCall
func (ss *StubServer) FullDuplexCall(stream testpb.TestService_FullDuplexCallServer) error {
func (ss *StubServer) FullDuplexCall(stream testgrpc.TestService_FullDuplexCallServer) error {
return ss.FullDuplexCallF(stream)
}
@ -107,7 +108,7 @@ func (ss *StubServer) StartServer(sopts ...grpc.ServerOption) error {
ss.cleanups = append(ss.cleanups, func() { lis.Close() })
s := grpc.NewServer(sopts...)
testpb.RegisterTestServiceServer(s, ss)
testgrpc.RegisterTestServiceServer(s, ss)
go s.Serve(lis)
ss.cleanups = append(ss.cleanups, s.Stop)
ss.S = s
@ -137,7 +138,7 @@ func (ss *StubServer) StartClient(dopts ...grpc.DialOption) error {
ss.cleanups = append(ss.cleanups, func() { cc.Close() })
ss.Client = testpb.NewTestServiceClient(cc)
ss.Client = testgrpc.NewTestServiceClient(cc)
return nil
}

View File

@ -29,8 +29,8 @@ import (
"google.golang.org/grpc/peer"
"google.golang.org/grpc/resolver"
testgrpc "google.golang.org/grpc/test/grpc_testing"
testpb "google.golang.org/grpc/test/grpc_testing"
testgrpc "google.golang.org/grpc/interop/grpc_testing"
testpb "google.golang.org/grpc/interop/grpc_testing"
)
// CheckRPCsToBackend makes a bunch of RPCs on the given ClientConn and verifies

View File

@ -32,8 +32,8 @@ import (
"google.golang.org/grpc/peer"
"google.golang.org/grpc/resolver"
testgrpc "google.golang.org/grpc/test/grpc_testing"
testpb "google.golang.org/grpc/test/grpc_testing"
testgrpc "google.golang.org/grpc/interop/grpc_testing"
testpb "google.golang.org/grpc/interop/grpc_testing"
)
var logger = grpclog.Component("testutils-roundrobin")

View File

@ -42,3 +42,5 @@ require (
replace google.golang.org/grpc => ../..
replace google.golang.org/grpc/gcp/observability => ../../gcp/observability
replace google.golang.org/grpc/stats/opencensus => ../../stats/opencensus

View File

@ -1305,8 +1305,6 @@ google.golang.org/genproto v0.0.0-20230222225845-10f96fb3dbec/go.mod h1:3Dl5ZL0q
google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 h1:DdoeryqhaXp1LtT/emMP1BRJPHHKFi5akj/nbx/zNTA=
google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4/go.mod h1:NWraEVixdDnqcqQ30jipen1STv2r/n24Wb7twVTGR4s=
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw=
google.golang.org/grpc/stats/opencensus v0.0.0-20230330193705-4a12595692ae h1:40UWCQ40A2NTDabsmbZNznFf9SUftDlaBASj7OCdKDY=
google.golang.org/grpc/stats/opencensus v0.0.0-20230330193705-4a12595692ae/go.mod h1:qPsHQZhltTPryCUC0naykSpbIJDodlCLM/vNa607CrE=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=

View File

@ -36,8 +36,8 @@ import (
"google.golang.org/grpc/orca"
v3orcapb "github.com/cncf/xds/go/xds/data/orca/v3"
testgrpc "google.golang.org/grpc/test/grpc_testing"
testpb "google.golang.org/grpc/test/grpc_testing"
testgrpc "google.golang.org/grpc/interop/grpc_testing"
testpb "google.golang.org/grpc/interop/grpc_testing"
)
type s struct {
@ -268,7 +268,7 @@ func (s) TestE2ECallMetricsStreaming(t *testing.T) {
}
// Send one request to the server.
payload := &testpb.Payload{Type: testpb.PayloadType_RANDOM, Body: make([]byte, 32)}
payload := &testpb.Payload{Body: make([]byte, 32)}
req := &testpb.StreamingOutputCallRequest{Payload: payload}
if err := stream.Send(req); err != nil {
t.Fatalf("stream.Send() failed: %v", err)

View File

@ -38,8 +38,8 @@ import (
v3orcapb "github.com/cncf/xds/go/xds/data/orca/v3"
v3orcaservicegrpc "github.com/cncf/xds/go/xds/service/orca/v3"
v3orcaservicepb "github.com/cncf/xds/go/xds/service/orca/v3"
testgrpc "google.golang.org/grpc/test/grpc_testing"
testpb "google.golang.org/grpc/test/grpc_testing"
testgrpc "google.golang.org/grpc/interop/grpc_testing"
testpb "google.golang.org/grpc/interop/grpc_testing"
)
const requestsMetricKey = "test-service-requests"
@ -98,7 +98,7 @@ func (s) Test_E2E_CustomBackendMetrics_OutOfBand(t *testing.T) {
}
// Register the test service implementation on the same grpc server, and start serving.
testpb.RegisterTestServiceServer(s, &testServiceImpl{orcaSrv: orcaSrv})
testgrpc.RegisterTestServiceServer(s, &testServiceImpl{orcaSrv: orcaSrv})
go s.Serve(lis)
defer s.Stop()
t.Logf("Started gRPC server at %s...", lis.Addr().String())

View File

@ -38,7 +38,9 @@ import (
"google.golang.org/grpc/internal/leakcheck"
"google.golang.org/grpc/internal/stubserver"
"google.golang.org/grpc/internal/testutils"
"google.golang.org/grpc/test/grpc_testing"
testgrpc "google.golang.org/grpc/interop/grpc_testing"
testpb "google.golang.org/grpc/interop/grpc_testing"
)
type s struct {
@ -275,12 +277,12 @@ func (s) TestAllMetricsOneFunction(t *testing.T) {
defer view.UnregisterExporter(fe)
ss := &stubserver.StubServer{
UnaryCallF: func(ctx context.Context, in *grpc_testing.SimpleRequest) (*grpc_testing.SimpleResponse, error) {
return &grpc_testing.SimpleResponse{Payload: &grpc_testing.Payload{
UnaryCallF: func(ctx context.Context, in *testpb.SimpleRequest) (*testpb.SimpleResponse, error) {
return &testpb.SimpleResponse{Payload: &testpb.Payload{
Body: make([]byte, 10000),
}}, nil
},
FullDuplexCallF: func(stream grpc_testing.TestService_FullDuplexCallServer) error {
FullDuplexCallF: func(stream testgrpc.TestService_FullDuplexCallServer) error {
for {
_, err := stream.Recv()
if err == io.EOF {
@ -297,7 +299,7 @@ func (s) TestAllMetricsOneFunction(t *testing.T) {
defer cancel()
// Make two RPC's, a unary RPC and a streaming RPC. These should cause
// certain metrics to be emitted.
if _, err := ss.Client.UnaryCall(ctx, &grpc_testing.SimpleRequest{Payload: &grpc_testing.Payload{
if _, err := ss.Client.UnaryCall(ctx, &testpb.SimpleRequest{Payload: &testpb.Payload{
Body: make([]byte, 10000),
}}, grpc.UseCompressor(gzip.Name)); err != nil {
t.Fatalf("Unexpected error from UnaryCall: %v", err)
@ -1037,7 +1039,7 @@ func (s) TestOpenCensusTags(t *testing.T) {
// populated at the client side application layer if populated.
tmCh := testutils.NewChannel()
ss := &stubserver.StubServer{
UnaryCallF: func(ctx context.Context, in *grpc_testing.SimpleRequest) (*grpc_testing.SimpleResponse, error) {
UnaryCallF: func(ctx context.Context, in *testpb.SimpleRequest) (*testpb.SimpleResponse, error) {
// Do the sends of the tag maps for assertions in this main testing
// goroutine. Do the receives and assertions in a forked goroutine.
if tm := tag.FromContext(ctx); tm != nil {
@ -1045,7 +1047,7 @@ func (s) TestOpenCensusTags(t *testing.T) {
} else {
tmCh.Send(errors.New("no tag map received server side"))
}
return &grpc_testing.SimpleResponse{}, nil
return &testpb.SimpleResponse{}, nil
},
}
if err := ss.Start([]grpc.ServerOption{ServerOption(TraceOptions{})}, DialOption(TraceOptions{})); err != nil {
@ -1120,7 +1122,7 @@ func (s) TestOpenCensusTags(t *testing.T) {
// keyServerMethod.
ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
defer cancel()
if _, err := ss.Client.UnaryCall(ctx, &grpc_testing.SimpleRequest{Payload: &grpc_testing.Payload{}}); err != nil {
if _, err := ss.Client.UnaryCall(ctx, &testpb.SimpleRequest{Payload: &testpb.Payload{}}); err != nil {
t.Fatalf("Unexpected error from UnaryCall: %v", err)
}
@ -1150,7 +1152,7 @@ func (s) TestOpenCensusTags(t *testing.T) {
// Make a unary RPC with a populated OpenCensus tag map. The server side
// should receive an OpenCensus tag map containing this populated tag map
// with the keyServerMethod tag appended to it.
if _, err := ss.Client.UnaryCall(ctx, &grpc_testing.SimpleRequest{Payload: &grpc_testing.Payload{}}); err != nil {
if _, err := ss.Client.UnaryCall(ctx, &testpb.SimpleRequest{Payload: &testpb.Payload{}}); err != nil {
t.Fatalf("Unexpected error from UnaryCall: %v", err)
}
if chErr, err := readerErrCh.Receive(ctx); chErr != nil || err != nil {
@ -1352,10 +1354,10 @@ func (s) TestSpan(t *testing.T) {
DisableTrace: false,
}
ss := &stubserver.StubServer{
UnaryCallF: func(ctx context.Context, in *grpc_testing.SimpleRequest) (*grpc_testing.SimpleResponse, error) {
return &grpc_testing.SimpleResponse{}, nil
UnaryCallF: func(ctx context.Context, in *testpb.SimpleRequest) (*testpb.SimpleResponse, error) {
return &testpb.SimpleResponse{}, nil
},
FullDuplexCallF: func(stream grpc_testing.TestService_FullDuplexCallServer) error {
FullDuplexCallF: func(stream testgrpc.TestService_FullDuplexCallServer) error {
for {
_, err := stream.Recv()
if err == io.EOF {
@ -1376,7 +1378,7 @@ func (s) TestSpan(t *testing.T) {
// both from the client and the server. Note that RPCs trigger exports of
// corresponding span data synchronously, thus the Span Data is guaranteed
// to have been read by exporter and is ready to make assertions on.
if _, err := ss.Client.UnaryCall(ctx, &grpc_testing.SimpleRequest{Payload: &grpc_testing.Payload{}}); err != nil {
if _, err := ss.Client.UnaryCall(ctx, &testpb.SimpleRequest{Payload: &testpb.Payload{}}); err != nil {
t.Fatalf("Unexpected error from UnaryCall: %v", err)
}
@ -1475,10 +1477,10 @@ func (s) TestSpan(t *testing.T) {
}
// Send two messages. This should be recorded in the emitted spans message
// events, with message IDs which increase for each message.
if err := stream.Send(&grpc_testing.StreamingOutputCallRequest{}); err != nil {
if err := stream.Send(&testpb.StreamingOutputCallRequest{}); err != nil {
t.Fatalf("stream.Send failed: %v", err)
}
if err := stream.Send(&grpc_testing.StreamingOutputCallRequest{}); err != nil {
if err := stream.Send(&testpb.StreamingOutputCallRequest{}); err != nil {
t.Fatalf("stream.Send failed: %v", err)
}

View File

@ -5,7 +5,7 @@ go 1.17
require (
github.com/google/go-cmp v0.5.9
go.opencensus.io v0.24.0
google.golang.org/grpc v1.53.0-dev.0.20230315171901-a1e657ce53ba
google.golang.org/grpc v1.53.0
)
require (
@ -14,6 +14,8 @@ require (
golang.org/x/net v0.8.0 // indirect
golang.org/x/sys v0.6.0 // indirect
golang.org/x/text v0.8.0 // indirect
google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect
google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 // indirect
google.golang.org/protobuf v1.30.0 // indirect
)
replace google.golang.org/grpc => ../..

File diff suppressed because it is too large Load Diff

View File

@ -26,7 +26,8 @@ import (
"google.golang.org/grpc/codes"
"google.golang.org/grpc/internal/grpctest"
"google.golang.org/grpc/status"
"google.golang.org/grpc/test/grpc_testing"
testpb "google.golang.org/grpc/interop/grpc_testing"
)
type s struct {
@ -49,7 +50,7 @@ func errWithDetails(t *testing.T, s *status.Status, details ...proto.Message) er
func (s) TestErrorIs(t *testing.T) {
// Test errors.
testErr := status.Error(codes.Internal, "internal server error")
testErrWithDetails := errWithDetails(t, status.New(codes.Internal, "internal server error"), &grpc_testing.Empty{})
testErrWithDetails := errWithDetails(t, status.New(codes.Internal, "internal server error"), &testpb.Empty{})
// Test cases.
testCases := []struct {
@ -62,8 +63,8 @@ func (s) TestErrorIs(t *testing.T) {
{err1: testErr, err2: status.Error(codes.Unknown, "internal server error"), want: false},
{err1: testErr, err2: errors.New("non-grpc error"), want: false},
{err1: testErrWithDetails, err2: status.Error(codes.Internal, "internal server error"), want: false},
{err1: testErrWithDetails, err2: errWithDetails(t, status.New(codes.Internal, "internal server error"), &grpc_testing.Empty{}), want: true},
{err1: testErrWithDetails, err2: errWithDetails(t, status.New(codes.Internal, "internal server error"), &grpc_testing.Empty{}, &grpc_testing.Empty{}), want: false},
{err1: testErrWithDetails, err2: errWithDetails(t, status.New(codes.Internal, "internal server error"), &testpb.Empty{}), want: true},
{err1: testErrWithDetails, err2: errWithDetails(t, status.New(codes.Internal, "internal server error"), &testpb.Empty{}, &testpb.Empty{}), want: false},
}
for _, tc := range testCases {

View File

@ -39,7 +39,9 @@ import (
"google.golang.org/grpc/resolver"
"google.golang.org/grpc/resolver/manual"
"google.golang.org/grpc/status"
testpb "google.golang.org/grpc/test/grpc_testing"
testgrpc "google.golang.org/grpc/interop/grpc_testing"
testpb "google.golang.org/grpc/interop/grpc_testing"
)
func authorityChecker(ctx context.Context, expectedAuthority string) (*testpb.Empty, error) {
@ -202,7 +204,7 @@ func (s) TestColonPortAuthority(t *testing.T) {
defer cc.Close()
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
_, err = testpb.NewTestServiceClient(cc).EmptyCall(ctx, &testpb.Empty{})
_, err = testgrpc.NewTestServiceClient(cc).EmptyCall(ctx, &testpb.Empty{})
if err != nil {
t.Errorf("us.client.EmptyCall(_, _) = _, %v; want _, nil", err)
}
@ -235,7 +237,7 @@ func (s) TestAuthorityReplacedWithResolverAddress(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
defer cancel()
if _, err = testpb.NewTestServiceClient(cc).EmptyCall(ctx, &testpb.Empty{}); err != nil {
if _, err = testgrpc.NewTestServiceClient(cc).EmptyCall(ctx, &testpb.Empty{}); err != nil {
t.Fatalf("EmptyCall() rpc failed: %v", err)
}
}

View File

@ -36,7 +36,8 @@ import (
"google.golang.org/grpc/resolver"
"google.golang.org/grpc/resolver/manual"
testpb "google.golang.org/grpc/test/grpc_testing"
testgrpc "google.golang.org/grpc/interop/grpc_testing"
testpb "google.golang.org/grpc/interop/grpc_testing"
)
const (
@ -137,7 +138,7 @@ func (s) TestBalancerSwitch_Basic(t *testing.T) {
Addresses: addrs,
ServiceConfig: parseServiceConfig(t, r, rrServiceConfig),
})
client := testpb.NewTestServiceClient(cc)
client := testgrpc.NewTestServiceClient(cc)
if err := rrutil.CheckRoundRobinRPCs(ctx, client, addrs); err != nil {
t.Fatal(err)
}
@ -173,7 +174,7 @@ func (s) TestBalancerSwitch_grpclbToPickFirst(t *testing.T) {
r.UpdateState(resolver.State{Addresses: []resolver.Address{{Addr: lbServer.Address(), Type: resolver.GRPCLB}}})
ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
defer cancel()
client := testpb.NewTestServiceClient(cc)
client := testgrpc.NewTestServiceClient(cc)
if err := rrutil.CheckRoundRobinRPCs(ctx, client, addrs[0:1]); err != nil {
t.Fatal(err)
}
@ -225,7 +226,7 @@ func (s) TestBalancerSwitch_pickFirstToGRPCLB(t *testing.T) {
// to the grpclb server we created above. This will cause the channel to
// switch to the "grpclb" balancer, which returns a single backend address.
r.UpdateState(resolver.State{Addresses: []resolver.Address{{Addr: lbServer.Address(), Type: resolver.GRPCLB}}})
client := testpb.NewTestServiceClient(cc)
client := testgrpc.NewTestServiceClient(cc)
if err := rrutil.CheckRoundRobinRPCs(ctx, client, addrs[:1]); err != nil {
t.Fatal(err)
}
@ -278,7 +279,7 @@ func (s) TestBalancerSwitch_RoundRobinToGRPCLB(t *testing.T) {
r.UpdateState(resolver.State{Addresses: addrs[1:], ServiceConfig: scpr})
ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
defer cancel()
client := testpb.NewTestServiceClient(cc)
client := testgrpc.NewTestServiceClient(cc)
if err := rrutil.CheckRoundRobinRPCs(ctx, client, addrs[1:]); err != nil {
t.Fatal(err)
}
@ -344,7 +345,7 @@ func (s) TestBalancerSwitch_grpclbNotRegistered(t *testing.T) {
Addresses: addrs,
ServiceConfig: parseServiceConfig(t, r, rrServiceConfig),
})
client := testpb.NewTestServiceClient(cc)
client := testgrpc.NewTestServiceClient(cc)
if err := rrutil.CheckRoundRobinRPCs(ctx, client, addrs[1:]); err != nil {
t.Fatal(err)
}
@ -383,7 +384,7 @@ func (s) TestBalancerSwitch_grpclbAddressOverridesLoadBalancingPolicy(t *testing
r.UpdateState(resolver.State{
Addresses: append(addrs[1:], resolver.Address{Addr: lbServer.Address(), Type: resolver.GRPCLB}),
})
client := testpb.NewTestServiceClient(cc)
client := testgrpc.NewTestServiceClient(cc)
if err := rrutil.CheckRoundRobinRPCs(ctx, client, addrs[:1]); err != nil {
t.Fatal(err)
}
@ -431,7 +432,7 @@ func (s) TestBalancerSwitch_LoadBalancingConfigTrumps(t *testing.T) {
r.UpdateState(resolver.State{Addresses: []resolver.Address{{Addr: lbServer.Address(), Type: resolver.GRPCLB}}})
ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
defer cancel()
client := testpb.NewTestServiceClient(cc)
client := testgrpc.NewTestServiceClient(cc)
if err := rrutil.CheckRoundRobinRPCs(ctx, client, addrs[:1]); err != nil {
t.Fatal(err)
}
@ -555,7 +556,7 @@ func (s) TestBalancerSwitch_Graceful(t *testing.T) {
Addresses: addrs[1:],
ServiceConfig: parseServiceConfig(t, r, rrServiceConfig),
})
client := testpb.NewTestServiceClient(cc)
client := testgrpc.NewTestServiceClient(cc)
if err := rrutil.CheckRoundRobinRPCs(ctx, client, addrs[1:]); err != nil {
t.Fatal(err)
}

View File

@ -46,8 +46,10 @@ import (
"google.golang.org/grpc/resolver"
"google.golang.org/grpc/resolver/manual"
"google.golang.org/grpc/status"
testpb "google.golang.org/grpc/test/grpc_testing"
"google.golang.org/grpc/testdata"
testgrpc "google.golang.org/grpc/interop/grpc_testing"
testpb "google.golang.org/grpc/interop/grpc_testing"
)
const testBalancerName = "testbalancer"
@ -165,7 +167,7 @@ func (s) TestCredsBundleFromBalancer(t *testing.T) {
defer te.tearDown()
cc := te.clientConn()
tc := testpb.NewTestServiceClient(cc)
tc := testgrpc.NewTestServiceClient(cc)
if _, err := tc.EmptyCall(context.Background(), &testpb.Empty{}); err != nil {
t.Fatalf("Test failed. Reason: %v", err)
}
@ -202,7 +204,7 @@ func testPickExtraMetadata(t *testing.T, e env) {
r.InitialState(resolver.State{Addresses: []resolver.Address{{Addr: te.srvAddr}}})
te.resolverScheme = "xds"
cc := te.clientConn()
tc := testpb.NewTestServiceClient(cc)
tc := testgrpc.NewTestServiceClient(cc)
ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
defer cancel()
@ -242,7 +244,7 @@ func testDoneInfo(t *testing.T, e env) {
defer te.tearDown()
cc := te.clientConn()
tc := testpb.NewTestServiceClient(cc)
tc := testgrpc.NewTestServiceClient(cc)
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
@ -319,7 +321,7 @@ func testDoneLoads(t *testing.T) {
}
defer ss.Stop()
tc := testpb.NewTestServiceClient(ss.CC)
tc := testgrpc.NewTestServiceClient(ss.CC)
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
@ -509,7 +511,7 @@ func (s) TestAddressAttributesInNewSubConn(t *testing.T) {
}
s := grpc.NewServer()
testpb.RegisterTestServiceServer(s, &testServer{})
testgrpc.RegisterTestServiceServer(s, &testServer{})
go s.Serve(lis)
defer s.Stop()
t.Logf("Started gRPC server at %s...", lis.Addr().String())
@ -525,7 +527,7 @@ func (s) TestAddressAttributesInNewSubConn(t *testing.T) {
t.Fatal(err)
}
defer cc.Close()
tc := testpb.NewTestServiceClient(cc)
tc := testgrpc.NewTestServiceClient(cc)
t.Log("Created a ClientConn...")
// The first RPC should fail because there's no address.
@ -642,7 +644,7 @@ func (s) TestServersSwap(t *testing.T) {
return &testpb.SimpleResponse{Username: username}, nil
},
}
testpb.RegisterTestServiceServer(s, ts)
testgrpc.RegisterTestServiceServer(s, ts)
go s.Serve(lis)
return lis.Addr().String(), s.Stop
}
@ -661,7 +663,7 @@ func (s) TestServersSwap(t *testing.T) {
t.Fatalf("Error creating client: %v", err)
}
defer cc.Close()
client := testpb.NewTestServiceClient(cc)
client := testgrpc.NewTestServiceClient(cc)
// Confirm we are connected to the first server
if res, err := client.UnaryCall(ctx, &testpb.SimpleRequest{}); err != nil || res.Username != one {
@ -699,7 +701,7 @@ func (s) TestWaitForReady(t *testing.T) {
return &testpb.SimpleResponse{Username: one}, nil
},
}
testpb.RegisterTestServiceServer(s, ts)
testgrpc.RegisterTestServiceServer(s, ts)
go s.Serve(lis)
// Initialize client
@ -710,7 +712,7 @@ func (s) TestWaitForReady(t *testing.T) {
t.Fatalf("Error creating client: %v", err)
}
defer cc.Close()
client := testpb.NewTestServiceClient(cc)
client := testgrpc.NewTestServiceClient(cc)
// Report an error so non-WFR RPCs will give up early.
r.CC.ReportError(errors.New("fake resolver error"))
@ -827,7 +829,7 @@ func (s) TestAuthorityInBuildOptions(t *testing.T) {
}
s := grpc.NewServer()
testpb.RegisterTestServiceServer(s, &testServer{})
testgrpc.RegisterTestServiceServer(s, &testServer{})
go s.Serve(lis)
defer s.Stop()
t.Logf("Started gRPC server at %s...", lis.Addr().String())
@ -845,7 +847,7 @@ func (s) TestAuthorityInBuildOptions(t *testing.T) {
t.Fatal(err)
}
defer cc.Close()
tc := testpb.NewTestServiceClient(cc)
tc := testgrpc.NewTestServiceClient(cc)
t.Log("Created a ClientConn...")
ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
@ -968,7 +970,7 @@ func (s) TestMetadataInPickResult(t *testing.T) {
t.Fatalf("grpc.Dial(): %v", err)
}
defer cc.Close()
tc := testpb.NewTestServiceClient(cc)
tc := testgrpc.NewTestServiceClient(cc)
t.Log("Making EmptyCall() RPC with custom metadata...")
ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)

View File

@ -27,7 +27,8 @@ import (
"time"
"google.golang.org/grpc/internal/channelz"
testpb "google.golang.org/grpc/test/grpc_testing"
testgrpc "google.golang.org/grpc/interop/grpc_testing"
)
func (s) TestCZSocketMetricsSocketOption(t *testing.T) {
@ -44,7 +45,7 @@ func testCZSocketMetricsSocketOption(t *testing.T, e env) {
te.startServer(&testServer{security: e.security})
defer te.tearDown()
cc := te.clientConn()
tc := testpb.NewTestServiceClient(cc)
tc := testgrpc.NewTestServiceClient(cc)
doSuccessfulUnaryCall(tc, t)
time.Sleep(10 * time.Millisecond)

View File

@ -44,8 +44,10 @@ import (
"google.golang.org/grpc/resolver"
"google.golang.org/grpc/resolver/manual"
"google.golang.org/grpc/status"
testpb "google.golang.org/grpc/test/grpc_testing"
"google.golang.org/grpc/testdata"
testgrpc "google.golang.org/grpc/interop/grpc_testing"
testpb "google.golang.org/grpc/interop/grpc_testing"
)
func czCleanupWrapper(cleanup func() error, t *testing.T) {
@ -518,7 +520,7 @@ func (s) TestCZChannelMetrics(t *testing.T) {
te.resolverScheme = r.Scheme()
cc := te.clientConn(grpc.WithResolvers(r))
defer te.tearDown()
tc := testpb.NewTestServiceClient(cc)
tc := testgrpc.NewTestServiceClient(cc)
if _, err := tc.EmptyCall(context.Background(), &testpb.Empty{}); err != nil {
t.Fatalf("TestService/EmptyCall(_, _) = _, %v, want _, <nil>", err)
}
@ -598,7 +600,7 @@ func (s) TestCZServerMetrics(t *testing.T) {
te.startServer(&testServer{security: e.security})
defer te.tearDown()
cc := te.clientConn()
tc := testpb.NewTestServiceClient(cc)
tc := testgrpc.NewTestServiceClient(cc)
if _, err := tc.EmptyCall(context.Background(), &testpb.Empty{}); err != nil {
t.Fatalf("TestService/EmptyCall(_, _) = _, %v, want _, <nil>", err)
}
@ -646,7 +648,7 @@ func (s) TestCZServerMetrics(t *testing.T) {
}
type testServiceClientWrapper struct {
testpb.TestServiceClient
testgrpc.TestServiceClient
mu sync.RWMutex
streamsCreated int
}
@ -671,35 +673,35 @@ func (t *testServiceClientWrapper) UnaryCall(ctx context.Context, in *testpb.Sim
return t.TestServiceClient.UnaryCall(ctx, in, opts...)
}
func (t *testServiceClientWrapper) StreamingOutputCall(ctx context.Context, in *testpb.StreamingOutputCallRequest, opts ...grpc.CallOption) (testpb.TestService_StreamingOutputCallClient, error) {
func (t *testServiceClientWrapper) StreamingOutputCall(ctx context.Context, in *testpb.StreamingOutputCallRequest, opts ...grpc.CallOption) (testgrpc.TestService_StreamingOutputCallClient, error) {
t.mu.Lock()
defer t.mu.Unlock()
t.streamsCreated++
return t.TestServiceClient.StreamingOutputCall(ctx, in, opts...)
}
func (t *testServiceClientWrapper) StreamingInputCall(ctx context.Context, opts ...grpc.CallOption) (testpb.TestService_StreamingInputCallClient, error) {
func (t *testServiceClientWrapper) StreamingInputCall(ctx context.Context, opts ...grpc.CallOption) (testgrpc.TestService_StreamingInputCallClient, error) {
t.mu.Lock()
defer t.mu.Unlock()
t.streamsCreated++
return t.TestServiceClient.StreamingInputCall(ctx, opts...)
}
func (t *testServiceClientWrapper) FullDuplexCall(ctx context.Context, opts ...grpc.CallOption) (testpb.TestService_FullDuplexCallClient, error) {
func (t *testServiceClientWrapper) FullDuplexCall(ctx context.Context, opts ...grpc.CallOption) (testgrpc.TestService_FullDuplexCallClient, error) {
t.mu.Lock()
defer t.mu.Unlock()
t.streamsCreated++
return t.TestServiceClient.FullDuplexCall(ctx, opts...)
}
func (t *testServiceClientWrapper) HalfDuplexCall(ctx context.Context, opts ...grpc.CallOption) (testpb.TestService_HalfDuplexCallClient, error) {
func (t *testServiceClientWrapper) HalfDuplexCall(ctx context.Context, opts ...grpc.CallOption) (testgrpc.TestService_HalfDuplexCallClient, error) {
t.mu.Lock()
defer t.mu.Unlock()
t.streamsCreated++
return t.TestServiceClient.HalfDuplexCall(ctx, opts...)
}
func doSuccessfulUnaryCall(tc testpb.TestServiceClient, t *testing.T) {
func doSuccessfulUnaryCall(tc testgrpc.TestServiceClient, t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
defer cancel()
if _, err := tc.EmptyCall(ctx, &testpb.Empty{}); err != nil {
@ -707,7 +709,7 @@ func doSuccessfulUnaryCall(tc testpb.TestServiceClient, t *testing.T) {
}
}
func doStreamingInputCallWithLargePayload(tc testpb.TestServiceClient, t *testing.T) {
func doStreamingInputCallWithLargePayload(tc testgrpc.TestServiceClient, t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
defer cancel()
s, err := tc.StreamingInputCall(ctx)
@ -721,7 +723,7 @@ func doStreamingInputCallWithLargePayload(tc testpb.TestServiceClient, t *testin
s.Send(&testpb.StreamingInputCallRequest{Payload: payload})
}
func doServerSideFailedUnaryCall(tc testpb.TestServiceClient, t *testing.T) {
func doServerSideFailedUnaryCall(tc testgrpc.TestServiceClient, t *testing.T) {
const smallSize = 1
const largeSize = 2000
@ -741,7 +743,7 @@ func doServerSideFailedUnaryCall(tc testpb.TestServiceClient, t *testing.T) {
}
}
func doClientSideInitiatedFailedStream(tc testpb.TestServiceClient, t *testing.T) {
func doClientSideInitiatedFailedStream(tc testgrpc.TestServiceClient, t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
stream, err := tc.FullDuplexCall(ctx)
if err != nil {
@ -774,7 +776,7 @@ func doClientSideInitiatedFailedStream(tc testpb.TestServiceClient, t *testing.T
}
// This func is to be used to test client side counting of failed streams.
func doServerSideInitiatedFailedStreamWithRSTStream(tc testpb.TestServiceClient, t *testing.T, l *listenerWrapper) {
func doServerSideInitiatedFailedStreamWithRSTStream(tc testgrpc.TestServiceClient, t *testing.T, l *listenerWrapper) {
stream, err := tc.FullDuplexCall(context.Background())
if err != nil {
t.Fatalf("TestService/FullDuplexCall(_) = _, %v, want <nil>", err)
@ -812,7 +814,7 @@ func doServerSideInitiatedFailedStreamWithRSTStream(tc testpb.TestServiceClient,
}
// this func is to be used to test client side counting of failed streams.
func doServerSideInitiatedFailedStreamWithGoAway(tc testpb.TestServiceClient, t *testing.T, l *listenerWrapper) {
func doServerSideInitiatedFailedStreamWithGoAway(tc testgrpc.TestServiceClient, t *testing.T, l *listenerWrapper) {
// This call is just to keep the transport from shutting down (socket will be deleted
// in this case, and we will not be able to get metrics).
s, err := tc.FullDuplexCall(context.Background())
@ -854,7 +856,7 @@ func doServerSideInitiatedFailedStreamWithGoAway(tc testpb.TestServiceClient, t
}
}
func doIdleCallToInvokeKeepAlive(tc testpb.TestServiceClient, t *testing.T) {
func doIdleCallToInvokeKeepAlive(tc testgrpc.TestServiceClient, t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
_, err := tc.FullDuplexCall(ctx)
if err != nil {
@ -875,7 +877,7 @@ func (s) TestCZClientSocketMetricsStreamsAndMessagesCount(t *testing.T) {
rcw := te.startServerWithConnControl(&testServer{security: e.security})
defer te.tearDown()
cc := te.clientConn()
tc := &testServiceClientWrapper{TestServiceClient: testpb.NewTestServiceClient(cc)}
tc := &testServiceClientWrapper{TestServiceClient: testgrpc.NewTestServiceClient(cc)}
doSuccessfulUnaryCall(tc, t)
var scID, skID int64
@ -974,7 +976,7 @@ func (s) TestCZClientAndServerSocketMetricsStreamsCountFlowControlRSTStream(t *t
// Avoid overflowing connection level flow control window, which will lead to
// transport being closed.
te.serverInitialConnWindowSize = 65536 * 2
ts := &stubserver.StubServer{FullDuplexCallF: func(stream testpb.TestService_FullDuplexCallServer) error {
ts := &stubserver.StubServer{FullDuplexCallF: func(stream testgrpc.TestService_FullDuplexCallServer) error {
stream.Send(&testpb.StreamingOutputCallResponse{})
<-stream.Context().Done()
return status.Errorf(codes.DeadlineExceeded, "deadline exceeded or cancelled")
@ -982,7 +984,7 @@ func (s) TestCZClientAndServerSocketMetricsStreamsCountFlowControlRSTStream(t *t
te.startServer(ts)
defer te.tearDown()
cc, dw := te.clientConnWithConnControl()
tc := &testServiceClientWrapper{TestServiceClient: testpb.NewTestServiceClient(cc)}
tc := &testServiceClientWrapper{TestServiceClient: testgrpc.NewTestServiceClient(cc)}
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
stream, err := tc.FullDuplexCall(ctx)
@ -1062,7 +1064,7 @@ func (s) TestCZClientAndServerSocketMetricsFlowControl(t *testing.T) {
te.startServer(&testServer{security: e.security})
defer te.tearDown()
cc := te.clientConn()
tc := testpb.NewTestServiceClient(cc)
tc := testgrpc.NewTestServiceClient(cc)
for i := 0; i < 10; i++ {
doSuccessfulUnaryCall(tc, t)
@ -1225,7 +1227,7 @@ func (s) TestCZServerSocketMetricsStreamsAndMessagesCount(t *testing.T) {
te.startServer(&testServer{security: e.security})
defer te.tearDown()
cc, _ := te.clientConnWithConnControl()
tc := &testServiceClientWrapper{TestServiceClient: testpb.NewTestServiceClient(cc)}
tc := &testServiceClientWrapper{TestServiceClient: testgrpc.NewTestServiceClient(cc)}
var svrID int64
if err := verifyResultWithDelay(func() (bool, error) {
@ -1296,7 +1298,7 @@ func (s) TestCZServerSocketMetricsKeepAlive(t *testing.T) {
te.startServer(&testServer{security: e.security})
defer te.tearDown()
cc := te.clientConn()
tc := testpb.NewTestServiceClient(cc)
tc := testgrpc.NewTestServiceClient(cc)
start := time.Now()
doIdleCallToInvokeKeepAlive(tc, t)
@ -1697,7 +1699,7 @@ func (s) TestCZSubChannelPickedNewAddress(t *testing.T) {
te.resolverScheme = r.Scheme()
cc := te.clientConn(grpc.WithResolvers(r))
defer te.tearDown()
tc := testpb.NewTestServiceClient(cc)
tc := testgrpc.NewTestServiceClient(cc)
// make sure the connection is up
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
defer cancel()
@ -1766,7 +1768,7 @@ func (s) TestCZSubChannelConnectivityState(t *testing.T) {
te.resolverScheme = r.Scheme()
cc := te.clientConn(grpc.WithResolvers(r))
defer te.tearDown()
tc := testpb.NewTestServiceClient(cc)
tc := testgrpc.NewTestServiceClient(cc)
// make sure the connection is up
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
defer cancel()
@ -1865,7 +1867,7 @@ func (s) TestCZChannelConnectivityState(t *testing.T) {
te.resolverScheme = r.Scheme()
cc := te.clientConn(grpc.WithResolvers(r))
defer te.tearDown()
tc := testpb.NewTestServiceClient(cc)
tc := testgrpc.NewTestServiceClient(cc)
// make sure the connection is up
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
defer cancel()

View File

@ -29,10 +29,10 @@ import (
"google.golang.org/grpc/codes"
"google.golang.org/grpc/credentials/insecure"
"google.golang.org/grpc/internal/channelz"
testgrpc "google.golang.org/grpc/interop/grpc_testing"
testpb "google.golang.org/grpc/interop/grpc_testing"
"google.golang.org/grpc/resolver/manual"
"google.golang.org/grpc/status"
testgrpc "google.golang.org/grpc/test/grpc_testing"
testpb "google.golang.org/grpc/test/grpc_testing"
)
// TestClientConnClose_WithPendingRPC tests the scenario where the channel has

View File

@ -36,7 +36,9 @@ import (
"google.golang.org/grpc/internal/stubserver"
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/status"
testpb "google.golang.org/grpc/test/grpc_testing"
testgrpc "google.golang.org/grpc/interop/grpc_testing"
testpb "google.golang.org/grpc/interop/grpc_testing"
)
func (s) TestCompressServerHasNoSupport(t *testing.T) {
@ -52,7 +54,7 @@ func testCompressServerHasNoSupport(t *testing.T, e env) {
te.clientNopCompression = true
te.startServer(&testServer{security: e.security})
defer te.tearDown()
tc := testpb.NewTestServiceClient(te.clientConn())
tc := testgrpc.NewTestServiceClient(te.clientConn())
const argSize = 271828
const respSize = 314159
@ -93,7 +95,7 @@ func testCompressOK(t *testing.T, e env) {
te.clientCompression = true
te.startServer(&testServer{security: e.security})
defer te.tearDown()
tc := testpb.NewTestServiceClient(te.clientConn())
tc := testgrpc.NewTestServiceClient(te.clientConn())
// Unary call
const argSize = 271828
@ -154,7 +156,7 @@ func testIdentityEncoding(t *testing.T, e env) {
te := newTest(t, e)
te.startServer(&testServer{security: e.security})
defer te.tearDown()
tc := testpb.NewTestServiceClient(te.clientConn())
tc := testgrpc.NewTestServiceClient(te.clientConn())
// Unary call
payload, err := newPayload(testpb.PayloadType_COMPRESSABLE, 5)
@ -355,7 +357,7 @@ func testUnarySetSendCompressorSuccess(t *testing.T, resCompressor string, wantC
func testStreamSetSendCompressorSuccess(t *testing.T, resCompressor string, wantCompressInvokes int32, dialOpts []grpc.DialOption) {
wc := setupGzipWrapCompressor(t)
ss := &stubserver.StubServer{
FullDuplexCallF: func(stream testpb.TestService_FullDuplexCallServer) error {
FullDuplexCallF: func(stream testgrpc.TestService_FullDuplexCallServer) error {
if _, err := stream.Recv(); err != nil {
return err
}
@ -448,7 +450,7 @@ func testUnarySetSendCompressorFailure(t *testing.T, resCompressor string, wantE
func testStreamSetSendCompressorFailure(t *testing.T, resCompressor string, wantErr error) {
ss := &stubserver.StubServer{
FullDuplexCallF: func(stream testpb.TestService_FullDuplexCallServer) error {
FullDuplexCallF: func(stream testgrpc.TestService_FullDuplexCallServer) error {
if _, err := stream.Recv(); err != nil {
return err
}
@ -511,7 +513,7 @@ func (s) TestUnarySetSendCompressorAfterHeaderSendFailure(t *testing.T) {
func (s) TestStreamSetSendCompressorAfterHeaderSendFailure(t *testing.T) {
ss := &stubserver.StubServer{
FullDuplexCallF: func(stream testpb.TestService_FullDuplexCallServer) error {
FullDuplexCallF: func(stream testgrpc.TestService_FullDuplexCallServer) error {
// Send headers early and then set send compressor.
grpc.SendHeader(stream.Context(), metadata.MD{})
err := grpc.SetSendCompressor(stream.Context(), "gzip")
@ -612,7 +614,7 @@ func testCompressorRegister(t *testing.T, e env) {
te.startServer(&testServer{security: e.security})
defer te.tearDown()
tc := testpb.NewTestServiceClient(te.clientConn())
tc := testgrpc.NewTestServiceClient(te.clientConn())
// Unary call
const argSize = 271828

View File

@ -31,11 +31,11 @@ import (
"google.golang.org/grpc/internal/serviceconfig"
"google.golang.org/grpc/internal/stubserver"
"google.golang.org/grpc/internal/testutils"
testpb "google.golang.org/grpc/interop/grpc_testing"
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/resolver"
"google.golang.org/grpc/resolver/manual"
"google.golang.org/grpc/status"
testpb "google.golang.org/grpc/test/grpc_testing"
)
type funcConfigSelector struct {

View File

@ -29,12 +29,14 @@ import (
"google.golang.org/grpc/internal/stubserver"
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/status"
testpb "google.golang.org/grpc/test/grpc_testing"
testgrpc "google.golang.org/grpc/interop/grpc_testing"
testpb "google.golang.org/grpc/interop/grpc_testing"
)
func (s) TestContextCanceled(t *testing.T) {
ss := &stubserver.StubServer{
FullDuplexCallF: func(stream testpb.TestService_FullDuplexCallServer) error {
FullDuplexCallF: func(stream testgrpc.TestService_FullDuplexCallServer) error {
stream.SetTrailer(metadata.New(map[string]string{"a": "b"}))
return status.Error(codes.PermissionDenied, "perm denied")
},
@ -123,7 +125,7 @@ func (s) TestContextCanceled(t *testing.T) {
// will be inconsistent, and it causes internal error.
func (s) TestCancelWhileRecvingWithCompression(t *testing.T) {
ss := &stubserver.StubServer{
FullDuplexCallF: func(stream testpb.TestService_FullDuplexCallServer) error {
FullDuplexCallF: func(stream testgrpc.TestService_FullDuplexCallServer) error {
for {
if err := stream.Send(&testpb.StreamingOutputCallResponse{
Payload: nil,

View File

@ -32,10 +32,10 @@ import (
"google.golang.org/grpc/internal/balancer/stub"
iresolver "google.golang.org/grpc/internal/resolver"
"google.golang.org/grpc/internal/stubserver"
testpb "google.golang.org/grpc/interop/grpc_testing"
"google.golang.org/grpc/resolver"
"google.golang.org/grpc/resolver/manual"
"google.golang.org/grpc/status"
testpb "google.golang.org/grpc/test/grpc_testing"
)
func (s) TestConfigSelectorStatusCodes(t *testing.T) {

View File

@ -37,8 +37,10 @@ import (
"google.golang.org/grpc/resolver/manual"
"google.golang.org/grpc/status"
"google.golang.org/grpc/tap"
testpb "google.golang.org/grpc/test/grpc_testing"
"google.golang.org/grpc/testdata"
testgrpc "google.golang.org/grpc/interop/grpc_testing"
testpb "google.golang.org/grpc/interop/grpc_testing"
)
const (
@ -92,7 +94,7 @@ func (s) TestCredsBundleBoth(t *testing.T) {
defer te.tearDown()
cc := te.clientConn()
tc := testpb.NewTestServiceClient(cc)
tc := testgrpc.NewTestServiceClient(cc)
ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
defer cancel()
if _, err := tc.EmptyCall(ctx, &testpb.Empty{}); err != nil {
@ -116,7 +118,7 @@ func (s) TestCredsBundleTransportCredentials(t *testing.T) {
defer te.tearDown()
cc := te.clientConn()
tc := testpb.NewTestServiceClient(cc)
tc := testgrpc.NewTestServiceClient(cc)
ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
defer cancel()
if _, err := tc.EmptyCall(ctx, &testpb.Empty{}); err != nil {
@ -134,7 +136,7 @@ func (s) TestCredsBundlePerRPCCredentials(t *testing.T) {
defer te.tearDown()
cc := te.clientConn()
tc := testpb.NewTestServiceClient(cc)
tc := testgrpc.NewTestServiceClient(cc)
ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
defer cancel()
if _, err := tc.EmptyCall(ctx, &testpb.Empty{}); err != nil {
@ -170,7 +172,7 @@ func (s) TestNonFailFastRPCSucceedOnTimeoutCreds(t *testing.T) {
defer te.tearDown()
cc := te.clientConn(grpc.WithTransportCredentials(&clientTimeoutCreds{}))
tc := testpb.NewTestServiceClient(cc)
tc := testgrpc.NewTestServiceClient(cc)
ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
defer cancel()
// This unary call should succeed, because ClientHandshake will succeed for the second time.
@ -196,7 +198,7 @@ func (s) TestGRPCMethodAccessibleToCredsViaContextRequestInfo(t *testing.T) {
defer te.tearDown()
cc := te.clientConn(grpc.WithPerRPCCredentials(&methodTestCreds{}))
tc := testpb.NewTestServiceClient(cc)
tc := testgrpc.NewTestServiceClient(cc)
ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
defer cancel()
@ -239,7 +241,7 @@ func (s) TestFailFastRPCErrorOnBadCertificates(t *testing.T) {
}
defer cc.Close()
tc := testpb.NewTestServiceClient(cc)
tc := testgrpc.NewTestServiceClient(cc)
for i := 0; i < 1000; i++ {
// This loop runs for at most 1 second. The first several RPCs will fail
// with Unavailable because the connection hasn't started. When the
@ -267,7 +269,7 @@ func (s) TestWaitForReadyRPCErrorOnBadCertificates(t *testing.T) {
}
defer cc.Close()
tc := testpb.NewTestServiceClient(cc)
tc := testgrpc.NewTestServiceClient(cc)
ctx, cancel := context.WithTimeout(context.Background(), 1*time.Second)
defer cancel()
if _, err = tc.EmptyCall(ctx, &testpb.Empty{}, grpc.WaitForReady(true)); strings.Contains(err.Error(), clientAlwaysFailCredErrorMsg) {
@ -332,7 +334,7 @@ func testPerRPCCredentialsViaDialOptions(t *testing.T, e env) {
defer te.tearDown()
cc := te.clientConn()
tc := testpb.NewTestServiceClient(cc)
tc := testgrpc.NewTestServiceClient(cc)
ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
defer cancel()
if _, err := tc.EmptyCall(ctx, &testpb.Empty{}); err != nil {
@ -353,7 +355,7 @@ func testPerRPCCredentialsViaCallOptions(t *testing.T, e env) {
defer te.tearDown()
cc := te.clientConn()
tc := testpb.NewTestServiceClient(cc)
tc := testgrpc.NewTestServiceClient(cc)
ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
defer cancel()
if _, err := tc.EmptyCall(ctx, &testpb.Empty{}, grpc.PerRPCCredentials(testPerRPCCredentials{authdata: authdata})); err != nil {
@ -395,7 +397,7 @@ func testPerRPCCredentialsViaDialOptionsAndCallOptions(t *testing.T, e env) {
defer te.tearDown()
cc := te.clientConn()
tc := testpb.NewTestServiceClient(cc)
tc := testgrpc.NewTestServiceClient(cc)
ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
defer cancel()
if _, err := tc.EmptyCall(ctx, &testpb.Empty{}, grpc.PerRPCCredentials(testPerRPCCredentials{authdata: authdata})); err != nil {

View File

@ -41,20 +41,15 @@ import (
"time"
"github.com/golang/protobuf/proto"
anypb "github.com/golang/protobuf/ptypes/any"
"golang.org/x/net/http2"
"golang.org/x/net/http2/hpack"
spb "google.golang.org/genproto/googleapis/rpc/status"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/connectivity"
"google.golang.org/grpc/credentials"
"google.golang.org/grpc/credentials/insecure"
"google.golang.org/grpc/encoding"
_ "google.golang.org/grpc/encoding/gzip"
"google.golang.org/grpc/health"
healthgrpc "google.golang.org/grpc/health/grpc_health_v1"
healthpb "google.golang.org/grpc/health/grpc_health_v1"
"google.golang.org/grpc/internal"
"google.golang.org/grpc/internal/binarylog"
"google.golang.org/grpc/internal/channelz"
@ -71,8 +66,16 @@ import (
"google.golang.org/grpc/status"
"google.golang.org/grpc/tap"
"google.golang.org/grpc/test/bufconn"
testpb "google.golang.org/grpc/test/grpc_testing"
"google.golang.org/grpc/testdata"
anypb "github.com/golang/protobuf/ptypes/any"
spb "google.golang.org/genproto/googleapis/rpc/status"
healthgrpc "google.golang.org/grpc/health/grpc_health_v1"
healthpb "google.golang.org/grpc/health/grpc_health_v1"
testgrpc "google.golang.org/grpc/interop/grpc_testing"
testpb "google.golang.org/grpc/interop/grpc_testing"
_ "google.golang.org/grpc/encoding/gzip"
)
const defaultHealthService = "grpc.health.v1.Health"
@ -129,7 +132,7 @@ var (
var raceMode bool // set by race.go in race mode
type testServer struct {
testpb.UnimplementedTestServiceServer
testgrpc.UnimplementedTestServiceServer
security string // indicate the authentication protocol used by this server.
earlyFail bool // whether to error out the execution of a service handler prematurely.
@ -162,8 +165,6 @@ func newPayload(t testpb.PayloadType, size int32) (*testpb.Payload, error) {
body := make([]byte, size)
switch t {
case testpb.PayloadType_COMPRESSABLE:
case testpb.PayloadType_UNCOMPRESSABLE:
return nil, fmt.Errorf("PayloadType UNCOMPRESSABLE is not supported")
default:
return nil, fmt.Errorf("unsupported payload type: %d", t)
}
@ -244,7 +245,7 @@ func (s *testServer) UnaryCall(ctx context.Context, in *testpb.SimpleRequest) (*
}, nil
}
func (s *testServer) StreamingOutputCall(args *testpb.StreamingOutputCallRequest, stream testpb.TestService_StreamingOutputCallServer) error {
func (s *testServer) StreamingOutputCall(args *testpb.StreamingOutputCallRequest, stream testgrpc.TestService_StreamingOutputCallServer) error {
if md, ok := metadata.FromIncomingContext(stream.Context()); ok {
if _, exists := md[":authority"]; !exists {
return status.Errorf(codes.DataLoss, "expected an :authority metadata: %v", md)
@ -275,7 +276,7 @@ func (s *testServer) StreamingOutputCall(args *testpb.StreamingOutputCallRequest
return nil
}
func (s *testServer) StreamingInputCall(stream testpb.TestService_StreamingInputCallServer) error {
func (s *testServer) StreamingInputCall(stream testgrpc.TestService_StreamingInputCallServer) error {
var sum int
for {
in, err := stream.Recv()
@ -295,7 +296,7 @@ func (s *testServer) StreamingInputCall(stream testpb.TestService_StreamingInput
}
}
func (s *testServer) FullDuplexCall(stream testpb.TestService_FullDuplexCallServer) error {
func (s *testServer) FullDuplexCall(stream testgrpc.TestService_FullDuplexCallServer) error {
md, ok := metadata.FromIncomingContext(stream.Context())
if ok {
if s.setAndSendHeader {
@ -359,7 +360,7 @@ func (s *testServer) FullDuplexCall(stream testpb.TestService_FullDuplexCallServ
}
}
func (s *testServer) HalfDuplexCall(stream testpb.TestService_HalfDuplexCallServer) error {
func (s *testServer) HalfDuplexCall(stream testgrpc.TestService_HalfDuplexCallServer) error {
var msgBuf []*testpb.StreamingOutputCallRequest
for {
in, err := stream.Recv()
@ -565,7 +566,7 @@ func newTest(t *testing.T, e env) *test {
return te
}
func (te *test) listenAndServe(ts testpb.TestServiceServer, listen func(network, address string) (net.Listener, error)) net.Listener {
func (te *test) listenAndServe(ts testgrpc.TestServiceServer, listen func(network, address string) (net.Listener, error)) net.Listener {
te.t.Helper()
te.t.Logf("Running test in %s environment...", te.e.name)
sopts := []grpc.ServerOption{grpc.MaxConcurrentStreams(te.maxStream)}
@ -625,7 +626,7 @@ func (te *test) listenAndServe(ts testpb.TestServiceServer, listen func(network,
sopts = append(sopts, te.customServerOptions...)
s := grpc.NewServer(sopts...)
if ts != nil {
testpb.RegisterTestServiceServer(s, ts)
testgrpc.RegisterTestServiceServer(s, ts)
}
// Create a new default health server if enableHealthServer is set, or use
@ -690,20 +691,20 @@ func (w wrapHS) Stop() {
w.s.Close()
}
func (te *test) startServerWithConnControl(ts testpb.TestServiceServer) *listenerWrapper {
func (te *test) startServerWithConnControl(ts testgrpc.TestServiceServer) *listenerWrapper {
l := te.listenAndServe(ts, listenWithConnControl)
return l.(*listenerWrapper)
}
// startServer starts a gRPC server exposing the provided TestService
// implementation. Callers should defer a call to te.tearDown to clean up
func (te *test) startServer(ts testpb.TestServiceServer) {
func (te *test) startServer(ts testgrpc.TestServiceServer) {
te.t.Helper()
te.listenAndServe(ts, net.Listen)
}
// startServers starts 'num' gRPC servers exposing the provided TestService.
func (te *test) startServers(ts testpb.TestServiceServer, num int) {
func (te *test) startServers(ts testgrpc.TestServiceServer, num int) {
for i := 0; i < num; i++ {
te.startServer(ts)
te.srvs = append(te.srvs, te.srv.(*grpc.Server))
@ -937,7 +938,7 @@ func (s) TestContextDeadlineNotIgnored(t *testing.T) {
defer te.tearDown()
cc := te.clientConn()
tc := testpb.NewTestServiceClient(cc)
tc := testgrpc.NewTestServiceClient(cc)
ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
if _, err := tc.EmptyCall(ctx, &testpb.Empty{}); err != nil {
t.Fatalf("TestService/EmptyCall(_, _) = _, %v, want _, <nil>", err)
@ -973,7 +974,7 @@ func testTimeoutOnDeadServer(t *testing.T, e env) {
defer te.tearDown()
cc := te.clientConn()
tc := testpb.NewTestServiceClient(cc)
tc := testgrpc.NewTestServiceClient(cc)
ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
if _, err := tc.EmptyCall(ctx, &testpb.Empty{}, grpc.WaitForReady(true)); err != nil {
t.Fatalf("TestService/EmptyCall(_, _) = _, %v, want _, <nil>", err)
@ -1025,7 +1026,7 @@ func (s) TestDetailedConnectionCloseErrorPropagatesToRpcError(t *testing.T) {
rpcStartedOnServer := make(chan struct{})
rpcDoneOnClient := make(chan struct{})
ss := &stubserver.StubServer{
FullDuplexCallF: func(stream testpb.TestService_FullDuplexCallServer) error {
FullDuplexCallF: func(stream testgrpc.TestService_FullDuplexCallServer) error {
close(rpcStartedOnServer)
<-rpcDoneOnClient
return status.Error(codes.Internal, "arbitrary status")
@ -1078,7 +1079,7 @@ func testFailFast(t *testing.T, e env) {
defer te.tearDown()
cc := te.clientConn()
tc := testpb.NewTestServiceClient(cc)
tc := testgrpc.NewTestServiceClient(cc)
ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
defer cancel()
if _, err := tc.EmptyCall(ctx, &testpb.Empty{}); err != nil {
@ -1168,7 +1169,7 @@ func (s) TestGetMethodConfig(t *testing.T) {
]
}`)})
tc := testpb.NewTestServiceClient(cc)
tc := testgrpc.NewTestServiceClient(cc)
// Make sure service config has been processed by grpc.
for {
@ -1252,7 +1253,7 @@ func (s) TestServiceConfigWaitForReady(t *testing.T) {
]
}`)})
tc := testpb.NewTestServiceClient(cc)
tc := testgrpc.NewTestServiceClient(cc)
// Make sure service config has been processed by grpc.
for {
@ -1341,7 +1342,7 @@ func (s) TestServiceConfigTimeout(t *testing.T) {
]
}`)})
tc := testpb.NewTestServiceClient(cc)
tc := testgrpc.NewTestServiceClient(cc)
// Make sure service config has been processed by grpc.
for {
@ -1459,7 +1460,7 @@ func (s) TestServiceConfigMaxMsgSize(t *testing.T) {
]
}`)
r.UpdateState(resolver.State{Addresses: addrs, ServiceConfig: sc})
tc := testpb.NewTestServiceClient(cc1)
tc := testgrpc.NewTestServiceClient(cc1)
req := &testpb.SimpleRequest{
ResponseType: testpb.PayloadType_COMPRESSABLE,
@ -1530,7 +1531,7 @@ func (s) TestServiceConfigMaxMsgSize(t *testing.T) {
defer te2.tearDown()
cc2 := te2.clientConn(grpc.WithResolvers(r))
r.UpdateState(resolver.State{Addresses: []resolver.Address{{Addr: te2.srvAddr}}, ServiceConfig: sc})
tc = testpb.NewTestServiceClient(cc2)
tc = testgrpc.NewTestServiceClient(cc2)
for {
if cc2.GetMethodConfig("/grpc.testing.TestService/FullDuplexCall").MaxReqSize != nil {
@ -1590,7 +1591,7 @@ func (s) TestServiceConfigMaxMsgSize(t *testing.T) {
cc3 := te3.clientConn(grpc.WithResolvers(r))
r.UpdateState(resolver.State{Addresses: []resolver.Address{{Addr: te3.srvAddr}}, ServiceConfig: sc})
tc = testpb.NewTestServiceClient(cc3)
tc = testgrpc.NewTestServiceClient(cc3)
for {
if cc3.GetMethodConfig("/grpc.testing.TestService/FullDuplexCall").MaxReqSize != nil {
@ -1675,7 +1676,7 @@ func (s) TestStreamingRPCWithTimeoutInServiceConfigRecv(t *testing.T) {
te.resolverScheme = r.Scheme()
cc := te.clientConn(grpc.WithResolvers(r))
tc := testpb.NewTestServiceClient(cc)
tc := testgrpc.NewTestServiceClient(cc)
r.UpdateState(resolver.State{
Addresses: []resolver.Address{{Addr: te.srvAddr}},
@ -1753,7 +1754,7 @@ func testPreloaderClientSend(t *testing.T, e env) {
te.startServer(&testServer{security: e.security})
defer te.tearDown()
tc := testpb.NewTestServiceClient(te.clientConn())
tc := testgrpc.NewTestServiceClient(te.clientConn())
// Test for streaming RPC recv.
// Set context for send with proper RPC Information
@ -1811,7 +1812,7 @@ func testPreloaderClientSend(t *testing.T, e env) {
func (s) TestPreloaderSenderSend(t *testing.T) {
ss := &stubserver.StubServer{
FullDuplexCallF: func(stream testpb.TestService_FullDuplexCallServer) error {
FullDuplexCallF: func(stream testgrpc.TestService_FullDuplexCallServer) error {
for i := 0; i < 10; i++ {
preparedMsg := &grpc.PreparedMsg{}
err := preparedMsg.Encode(stream, &testpb.StreamingOutputCallResponse{
@ -1882,7 +1883,7 @@ func testMaxMsgSizeClientDefault(t *testing.T, e env) {
te.startServer(&testServer{security: e.security})
defer te.tearDown()
tc := testpb.NewTestServiceClient(te.clientConn())
tc := testgrpc.NewTestServiceClient(te.clientConn())
const smallSize = 1
const largeSize = 4 * 1024 * 1024
@ -1949,7 +1950,7 @@ func testMaxMsgSizeClientAPI(t *testing.T, e env) {
te.startServer(&testServer{security: e.security})
defer te.tearDown()
tc := testpb.NewTestServiceClient(te.clientConn())
tc := testgrpc.NewTestServiceClient(te.clientConn())
const smallSize = 1
const largeSize = 1024
@ -2037,7 +2038,7 @@ func testMaxMsgSizeServerAPI(t *testing.T, e env) {
te.startServer(&testServer{security: e.security})
defer te.tearDown()
tc := testpb.NewTestServiceClient(te.clientConn())
tc := testgrpc.NewTestServiceClient(te.clientConn())
const smallSize = 1
const largeSize = 1024
@ -2149,7 +2150,7 @@ func testTap(t *testing.T, e env) {
defer te.tearDown()
cc := te.clientConn()
tc := testpb.NewTestServiceClient(cc)
tc := testgrpc.NewTestServiceClient(cc)
ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
defer cancel()
if _, err := tc.EmptyCall(ctx, &testpb.Empty{}); err != nil {
@ -2194,7 +2195,7 @@ func testEmptyUnaryWithUserAgent(t *testing.T, e env) {
defer te.tearDown()
cc := te.clientConn()
tc := testpb.NewTestServiceClient(cc)
tc := testgrpc.NewTestServiceClient(cc)
var header metadata.MD
ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
defer cancel()
@ -2225,7 +2226,7 @@ func testFailedEmptyUnary(t *testing.T, e env) {
te.userAgent = failAppUA
te.startServer(&testServer{security: e.security})
defer te.tearDown()
tc := testpb.NewTestServiceClient(te.clientConn())
tc := testgrpc.NewTestServiceClient(te.clientConn())
ctx := metadata.NewOutgoingContext(context.Background(), testMetadata)
wantErr := detailedError
@ -2244,7 +2245,7 @@ func testLargeUnary(t *testing.T, e env) {
te := newTest(t, e)
te.startServer(&testServer{security: e.security})
defer te.tearDown()
tc := testpb.NewTestServiceClient(te.clientConn())
tc := testgrpc.NewTestServiceClient(te.clientConn())
const argSize = 271828
const respSize = 314159
@ -2286,7 +2287,7 @@ func testExceedMsgLimit(t *testing.T, e env) {
te.maxServerMsgSize, te.maxClientMsgSize = newInt(maxMsgSize), newInt(maxMsgSize)
te.startServer(&testServer{security: e.security})
defer te.tearDown()
tc := testpb.NewTestServiceClient(te.clientConn())
tc := testgrpc.NewTestServiceClient(te.clientConn())
largeSize := int32(maxMsgSize + 1)
const smallSize = 1
@ -2368,7 +2369,7 @@ func testPeerClientSide(t *testing.T, e env) {
te.userAgent = testAppUA
te.startServer(&testServer{security: e.security})
defer te.tearDown()
tc := testpb.NewTestServiceClient(te.clientConn())
tc := testgrpc.NewTestServiceClient(te.clientConn())
peer := new(peer.Peer)
ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
defer cancel()
@ -2410,7 +2411,7 @@ func testPeerNegative(t *testing.T, e env) {
defer te.tearDown()
cc := te.clientConn()
tc := testpb.NewTestServiceClient(cc)
tc := testgrpc.NewTestServiceClient(cc)
peer := new(peer.Peer)
ctx, cancel := context.WithCancel(context.Background())
cancel()
@ -2429,7 +2430,7 @@ func testPeerFailedRPC(t *testing.T, e env) {
te.startServer(&testServer{security: e.security})
defer te.tearDown()
tc := testpb.NewTestServiceClient(te.clientConn())
tc := testgrpc.NewTestServiceClient(te.clientConn())
ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
defer cancel()
@ -2484,7 +2485,7 @@ func testMetadataUnaryRPC(t *testing.T, e env) {
te := newTest(t, e)
te.startServer(&testServer{security: e.security})
defer te.tearDown()
tc := testpb.NewTestServiceClient(te.clientConn())
tc := testgrpc.NewTestServiceClient(te.clientConn())
const argSize = 2718
const respSize = 314
@ -2530,7 +2531,7 @@ func testMetadataOrderUnaryRPC(t *testing.T, e env) {
te := newTest(t, e)
te.startServer(&testServer{security: e.security})
defer te.tearDown()
tc := testpb.NewTestServiceClient(te.clientConn())
tc := testgrpc.NewTestServiceClient(te.clientConn())
ctx := metadata.NewOutgoingContext(context.Background(), testMetadata)
ctx = metadata.AppendToOutgoingContext(ctx, "key1", "value2")
@ -2568,7 +2569,7 @@ func testMultipleSetTrailerUnaryRPC(t *testing.T, e env) {
te := newTest(t, e)
te.startServer(&testServer{security: e.security, multipleSetTrailer: true})
defer te.tearDown()
tc := testpb.NewTestServiceClient(te.clientConn())
tc := testgrpc.NewTestServiceClient(te.clientConn())
const (
argSize = 1
@ -2605,7 +2606,7 @@ func testMultipleSetTrailerStreamingRPC(t *testing.T, e env) {
te := newTest(t, e)
te.startServer(&testServer{security: e.security, multipleSetTrailer: true})
defer te.tearDown()
tc := testpb.NewTestServiceClient(te.clientConn())
tc := testgrpc.NewTestServiceClient(te.clientConn())
ctx := metadata.NewOutgoingContext(context.Background(), testMetadata)
stream, err := tc.FullDuplexCall(ctx, grpc.WaitForReady(true))
@ -2640,7 +2641,7 @@ func testSetAndSendHeaderUnaryRPC(t *testing.T, e env) {
te := newTest(t, e)
te.startServer(&testServer{security: e.security, setAndSendHeader: true})
defer te.tearDown()
tc := testpb.NewTestServiceClient(te.clientConn())
tc := testgrpc.NewTestServiceClient(te.clientConn())
const (
argSize = 1
@ -2685,7 +2686,7 @@ func testMultipleSetHeaderUnaryRPC(t *testing.T, e env) {
te := newTest(t, e)
te.startServer(&testServer{security: e.security, setHeaderOnly: true})
defer te.tearDown()
tc := testpb.NewTestServiceClient(te.clientConn())
tc := testgrpc.NewTestServiceClient(te.clientConn())
const (
argSize = 1
@ -2730,7 +2731,7 @@ func testMultipleSetHeaderUnaryRPCError(t *testing.T, e env) {
te := newTest(t, e)
te.startServer(&testServer{security: e.security, setHeaderOnly: true})
defer te.tearDown()
tc := testpb.NewTestServiceClient(te.clientConn())
tc := testgrpc.NewTestServiceClient(te.clientConn())
const (
argSize = 1
@ -2774,7 +2775,7 @@ func testSetAndSendHeaderStreamingRPC(t *testing.T, e env) {
te := newTest(t, e)
te.startServer(&testServer{security: e.security, setAndSendHeader: true})
defer te.tearDown()
tc := testpb.NewTestServiceClient(te.clientConn())
tc := testgrpc.NewTestServiceClient(te.clientConn())
ctx := metadata.NewOutgoingContext(context.Background(), testMetadata)
stream, err := tc.FullDuplexCall(ctx)
@ -2815,7 +2816,7 @@ func testMultipleSetHeaderStreamingRPC(t *testing.T, e env) {
te := newTest(t, e)
te.startServer(&testServer{security: e.security, setHeaderOnly: true})
defer te.tearDown()
tc := testpb.NewTestServiceClient(te.clientConn())
tc := testgrpc.NewTestServiceClient(te.clientConn())
const (
argSize = 1
@ -2880,7 +2881,7 @@ func testMultipleSetHeaderStreamingRPCError(t *testing.T, e env) {
te := newTest(t, e)
te.startServer(&testServer{security: e.security, setHeaderOnly: true})
defer te.tearDown()
tc := testpb.NewTestServiceClient(te.clientConn())
tc := testgrpc.NewTestServiceClient(te.clientConn())
const (
argSize = 1
@ -2946,7 +2947,7 @@ func testMalformedHTTP2Metadata(t *testing.T, e env) {
te := newTest(t, e)
te.startServer(&testServer{security: e.security})
defer te.tearDown()
tc := testpb.NewTestServiceClient(te.clientConn())
tc := testgrpc.NewTestServiceClient(te.clientConn())
payload, err := newPayload(testpb.PayloadType_COMPRESSABLE, 2718)
if err != nil {
@ -3020,7 +3021,7 @@ func (s) TestTransparentRetry(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
client := testpb.NewTestServiceClient(cc)
client := testgrpc.NewTestServiceClient(cc)
for i, tc := range testCases {
stream, err := client.FullDuplexCall(ctx)
@ -3053,7 +3054,7 @@ func testCancel(t *testing.T, e env) {
defer te.tearDown()
cc := te.clientConn()
tc := testpb.NewTestServiceClient(cc)
tc := testgrpc.NewTestServiceClient(cc)
const argSize = 2718
const respSize = 314
@ -3090,7 +3091,7 @@ func testCancelNoIO(t *testing.T, e env) {
defer te.tearDown()
cc := te.clientConn()
tc := testpb.NewTestServiceClient(cc)
tc := testgrpc.NewTestServiceClient(cc)
// Start one blocked RPC for which we'll never send streaming
// input. This will consume the 1 maximum concurrent streams,
@ -3156,7 +3157,7 @@ func testNoService(t *testing.T, e env) {
defer te.tearDown()
cc := te.clientConn()
tc := testpb.NewTestServiceClient(cc)
tc := testgrpc.NewTestServiceClient(cc)
stream, err := tc.FullDuplexCall(te.ctx, grpc.WaitForReady(true))
if err != nil {
@ -3177,7 +3178,7 @@ func testPingPong(t *testing.T, e env) {
te := newTest(t, e)
te.startServer(&testServer{security: e.security})
defer te.tearDown()
tc := testpb.NewTestServiceClient(te.clientConn())
tc := testgrpc.NewTestServiceClient(te.clientConn())
stream, err := tc.FullDuplexCall(te.ctx)
if err != nil {
@ -3236,7 +3237,7 @@ func testMetadataStreamingRPC(t *testing.T, e env) {
te := newTest(t, e)
te.startServer(&testServer{security: e.security})
defer te.tearDown()
tc := testpb.NewTestServiceClient(te.clientConn())
tc := testgrpc.NewTestServiceClient(te.clientConn())
ctx := metadata.NewOutgoingContext(te.ctx, testMetadata)
stream, err := tc.FullDuplexCall(ctx)
@ -3315,7 +3316,7 @@ func testServerStreaming(t *testing.T, e env) {
te := newTest(t, e)
te.startServer(&testServer{security: e.security})
defer te.tearDown()
tc := testpb.NewTestServiceClient(te.clientConn())
tc := testgrpc.NewTestServiceClient(te.clientConn())
respParam := make([]*testpb.ResponseParameters, len(respSizes))
for i, s := range respSizes {
@ -3373,7 +3374,7 @@ func testFailedServerStreaming(t *testing.T, e env) {
te.userAgent = failAppUA
te.startServer(&testServer{security: e.security})
defer te.tearDown()
tc := testpb.NewTestServiceClient(te.clientConn())
tc := testgrpc.NewTestServiceClient(te.clientConn())
respParam := make([]*testpb.ResponseParameters, len(respSizes))
for i, s := range respSizes {
@ -3407,10 +3408,10 @@ func equalError(x, y error) bool {
//
// All other TestServiceServer methods crash if called.
type concurrentSendServer struct {
testpb.TestServiceServer
testgrpc.TestServiceServer
}
func (s concurrentSendServer) StreamingOutputCall(args *testpb.StreamingOutputCallRequest, stream testpb.TestService_StreamingOutputCallServer) error {
func (s concurrentSendServer) StreamingOutputCall(args *testpb.StreamingOutputCallRequest, stream testgrpc.TestService_StreamingOutputCallServer) error {
for i := 0; i < 10; i++ {
stream.Send(&testpb.StreamingOutputCallResponse{
Payload: &testpb.Payload{
@ -3434,7 +3435,7 @@ func testServerStreamingConcurrent(t *testing.T, e env) {
defer te.tearDown()
cc := te.clientConn()
tc := testpb.NewTestServiceClient(cc)
tc := testgrpc.NewTestServiceClient(cc)
doStreamingCall := func() {
req := &testpb.StreamingOutputCallRequest{}
@ -3515,7 +3516,7 @@ func testClientStreaming(t *testing.T, e env, sizes []int) {
te := newTest(t, e)
te.startServer(&testServer{security: e.security})
defer te.tearDown()
tc := testpb.NewTestServiceClient(te.clientConn())
tc := testgrpc.NewTestServiceClient(te.clientConn())
ctx, cancel := context.WithTimeout(te.ctx, time.Second*30)
defer cancel()
@ -3561,7 +3562,7 @@ func testClientStreamingError(t *testing.T, e env) {
te := newTest(t, e)
te.startServer(&testServer{security: e.security, earlyFail: true})
defer te.tearDown()
tc := testpb.NewTestServiceClient(te.clientConn())
tc := testgrpc.NewTestServiceClient(te.clientConn())
stream, err := tc.StreamingInputCall(te.ctx)
if err != nil {
@ -3608,7 +3609,7 @@ func testExceedMaxStreamsLimit(t *testing.T, e env) {
defer te.tearDown()
cc := te.clientConn()
tc := testpb.NewTestServiceClient(cc)
tc := testgrpc.NewTestServiceClient(cc)
_, err := tc.StreamingInputCall(te.ctx)
if err != nil {
@ -3648,7 +3649,7 @@ func testStreamsQuotaRecovery(t *testing.T, e env) {
defer te.tearDown()
cc := te.clientConn()
tc := testpb.NewTestServiceClient(cc)
tc := testgrpc.NewTestServiceClient(cc)
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
if _, err := tc.StreamingInputCall(ctx); err != nil {
@ -3724,7 +3725,7 @@ func testUnaryClientInterceptor(t *testing.T, e env) {
te.startServer(&testServer{security: e.security})
defer te.tearDown()
tc := testpb.NewTestServiceClient(te.clientConn())
tc := testgrpc.NewTestServiceClient(te.clientConn())
ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
defer cancel()
if _, err := tc.EmptyCall(ctx, &testpb.Empty{}); status.Code(err) != codes.NotFound {
@ -3752,7 +3753,7 @@ func testStreamClientInterceptor(t *testing.T, e env) {
te.startServer(&testServer{security: e.security})
defer te.tearDown()
tc := testpb.NewTestServiceClient(te.clientConn())
tc := testgrpc.NewTestServiceClient(te.clientConn())
respParam := []*testpb.ResponseParameters{
{
Size: int32(1),
@ -3790,7 +3791,7 @@ func testUnaryServerInterceptor(t *testing.T, e env) {
te.startServer(&testServer{security: e.security})
defer te.tearDown()
tc := testpb.NewTestServiceClient(te.clientConn())
tc := testgrpc.NewTestServiceClient(te.clientConn())
ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
defer cancel()
if _, err := tc.EmptyCall(ctx, &testpb.Empty{}); status.Code(err) != codes.PermissionDenied {
@ -3822,7 +3823,7 @@ func testStreamServerInterceptor(t *testing.T, e env) {
te.startServer(&testServer{security: e.security})
defer te.tearDown()
tc := testpb.NewTestServiceClient(te.clientConn())
tc := testgrpc.NewTestServiceClient(te.clientConn())
respParam := []*testpb.ResponseParameters{
{
Size: int32(1),
@ -3863,21 +3864,21 @@ func testStreamServerInterceptor(t *testing.T, e env) {
// Any unimplemented method will crash. Tests implement the method(s)
// they need.
type funcServer struct {
testpb.TestServiceServer
testgrpc.TestServiceServer
unaryCall func(ctx context.Context, in *testpb.SimpleRequest) (*testpb.SimpleResponse, error)
streamingInputCall func(stream testpb.TestService_StreamingInputCallServer) error
fullDuplexCall func(stream testpb.TestService_FullDuplexCallServer) error
streamingInputCall func(stream testgrpc.TestService_StreamingInputCallServer) error
fullDuplexCall func(stream testgrpc.TestService_FullDuplexCallServer) error
}
func (s *funcServer) UnaryCall(ctx context.Context, in *testpb.SimpleRequest) (*testpb.SimpleResponse, error) {
return s.unaryCall(ctx, in)
}
func (s *funcServer) StreamingInputCall(stream testpb.TestService_StreamingInputCallServer) error {
func (s *funcServer) StreamingInputCall(stream testgrpc.TestService_StreamingInputCallServer) error {
return s.streamingInputCall(stream)
}
func (s *funcServer) FullDuplexCall(stream testpb.TestService_FullDuplexCallServer) error {
func (s *funcServer) FullDuplexCall(stream testgrpc.TestService_FullDuplexCallServer) error {
return s.fullDuplexCall(stream)
}
@ -3973,7 +3974,7 @@ func (s) TestClientRequestBodyErrorCancelStreamingInput(t *testing.T) {
func testClientRequestBodyErrorCancelStreamingInput(t *testing.T, e env) {
te := newTest(t, e)
recvErr := make(chan error, 1)
ts := &funcServer{streamingInputCall: func(stream testpb.TestService_StreamingInputCallServer) error {
ts := &funcServer{streamingInputCall: func(stream testgrpc.TestService_StreamingInputCallServer) error {
_, err := stream.Recv()
recvErr <- err
return nil
@ -4015,7 +4016,7 @@ func testClientInitialHeaderEndStream(t *testing.T, e env) {
// checking.
handlerDone := make(chan struct{})
te := newTest(t, e)
ts := &funcServer{streamingInputCall: func(stream testpb.TestService_StreamingInputCallServer) error {
ts := &funcServer{streamingInputCall: func(stream testgrpc.TestService_StreamingInputCallServer) error {
defer close(handlerDone)
// Block on serverTester receiving RST_STREAM. This ensures server has closed
// stream before stream.Recv().
@ -4059,7 +4060,7 @@ func testClientSendDataAfterCloseSend(t *testing.T, e env) {
// checking.
handlerDone := make(chan struct{})
te := newTest(t, e)
ts := &funcServer{streamingInputCall: func(stream testpb.TestService_StreamingInputCallServer) error {
ts := &funcServer{streamingInputCall: func(stream testgrpc.TestService_StreamingInputCallServer) error {
defer close(handlerDone)
// Block on serverTester receiving RST_STREAM. This ensures server has closed
// stream before stream.Recv().
@ -4111,7 +4112,7 @@ func (s) TestClientResourceExhaustedCancelFullDuplex(t *testing.T) {
func testClientResourceExhaustedCancelFullDuplex(t *testing.T, e env) {
te := newTest(t, e)
recvErr := make(chan error, 1)
ts := &funcServer{fullDuplexCall: func(stream testpb.TestService_FullDuplexCallServer) error {
ts := &funcServer{fullDuplexCall: func(stream testgrpc.TestService_FullDuplexCallServer) error {
defer close(recvErr)
_, err := stream.Recv()
if err != nil {
@ -4149,7 +4150,7 @@ func testClientResourceExhaustedCancelFullDuplex(t *testing.T, e env) {
// client side when server send a large message.
te.maxClientReceiveMsgSize = newInt(10)
cc := te.clientConn()
tc := testpb.NewTestServiceClient(cc)
tc := testgrpc.NewTestServiceClient(cc)
ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
defer cancel()
@ -4203,7 +4204,7 @@ func (s) TestFailfastRPCFailOnFatalHandshakeError(t *testing.T) {
}
defer cc.Close()
tc := testpb.NewTestServiceClient(cc)
tc := testgrpc.NewTestServiceClient(cc)
// This unary call should fail, but not timeout.
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
defer cancel()
@ -4237,7 +4238,7 @@ func (s) TestFlowControlLogicalRace(t *testing.T) {
defer lis.Close()
s := grpc.NewServer()
testpb.RegisterTestServiceServer(s, &flowControlLogicalRaceServer{
testgrpc.RegisterTestServiceServer(s, &flowControlLogicalRaceServer{
itemCount: itemCount,
itemSize: itemSize,
})
@ -4250,7 +4251,7 @@ func (s) TestFlowControlLogicalRace(t *testing.T) {
t.Fatalf("grpc.Dial(%q) = %v", lis.Addr().String(), err)
}
defer cc.Close()
cl := testpb.NewTestServiceClient(cc)
cl := testgrpc.NewTestServiceClient(cc)
failures := 0
for i := 0; i < requestCount; i++ {
@ -4292,13 +4293,13 @@ func (s) TestFlowControlLogicalRace(t *testing.T) {
}
type flowControlLogicalRaceServer struct {
testpb.TestServiceServer
testgrpc.TestServiceServer
itemSize int
itemCount int
}
func (s *flowControlLogicalRaceServer) StreamingOutputCall(req *testpb.StreamingOutputCallRequest, srv testpb.TestService_StreamingOutputCallServer) error {
func (s *flowControlLogicalRaceServer) StreamingOutputCall(req *testpb.StreamingOutputCallRequest, srv testgrpc.TestService_StreamingOutputCallServer) error {
for i := 0; i < s.itemCount; i++ {
err := srv.Send(&testpb.StreamingOutputCallResponse{
Payload: &testpb.Payload{
@ -4598,7 +4599,7 @@ func (s) TestStreamingProxyDoesNotForwardMetadata(t *testing.T) {
// doFDC performs a FullDuplexCall with client and returns the error from the
// first stream.Recv call, or nil if that error is io.EOF. Calls t.Fatal if
// the stream cannot be established.
doFDC := func(ctx context.Context, client testpb.TestServiceClient) error {
doFDC := func(ctx context.Context, client testgrpc.TestServiceClient) error {
stream, err := client.FullDuplexCall(ctx)
if err != nil {
t.Fatalf("Unwanted error: %v", err)
@ -4611,7 +4612,7 @@ func (s) TestStreamingProxyDoesNotForwardMetadata(t *testing.T) {
// endpoint ensures mdkey is NOT in metadata and returns an error if it is.
endpoint := &stubserver.StubServer{
FullDuplexCallF: func(stream testpb.TestService_FullDuplexCallServer) error {
FullDuplexCallF: func(stream testgrpc.TestService_FullDuplexCallServer) error {
ctx := stream.Context()
if md, ok := metadata.FromIncomingContext(ctx); !ok || md[mdkey] != nil {
return status.Errorf(codes.Internal, "endpoint: md=%v; want !contains(%q)", md, mdkey)
@ -4627,7 +4628,7 @@ func (s) TestStreamingProxyDoesNotForwardMetadata(t *testing.T) {
// proxy ensures mdkey IS in metadata, then forwards the RPC to endpoint
// without explicitly copying the metadata.
proxy := &stubserver.StubServer{
FullDuplexCallF: func(stream testpb.TestService_FullDuplexCallServer) error {
FullDuplexCallF: func(stream testgrpc.TestService_FullDuplexCallServer) error {
ctx := stream.Context()
if md, ok := metadata.FromIncomingContext(ctx); !ok || md[mdkey] == nil {
return status.Errorf(codes.Internal, "endpoint: md=%v; want !contains(%q)", md, mdkey)
@ -4749,7 +4750,7 @@ func (s) TestTapTimeout(t *testing.T) {
func (s) TestClientWriteFailsAfterServerClosesStream(t *testing.T) {
ss := &stubserver.StubServer{
FullDuplexCallF: func(stream testpb.TestService_FullDuplexCallServer) error {
FullDuplexCallF: func(stream testgrpc.TestService_FullDuplexCallServer) error {
return status.Errorf(codes.Internal, "")
},
}
@ -4824,7 +4825,7 @@ func testConfigurableWindowSize(t *testing.T, e env, wc windowSizeConfig) {
defer te.tearDown()
cc := te.clientConn()
tc := testpb.NewTestServiceClient(cc)
tc := testgrpc.NewTestServiceClient(cc)
ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
defer cancel()
stream, err := tc.FullDuplexCall(ctx)
@ -4876,7 +4877,7 @@ func testWaitForReadyConnection(t *testing.T, e env) {
defer te.tearDown()
cc := te.clientConn() // Non-blocking dial.
tc := testpb.NewTestServiceClient(cc)
tc := testgrpc.NewTestServiceClient(cc)
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
defer cancel()
state := cc.GetState()
@ -4953,7 +4954,7 @@ func testEncodeDoesntPanic(t *testing.T, e env) {
te.startServer(&testServer{security: e.security})
defer te.tearDown()
te.customCodec = nil
tc := testpb.NewTestServiceClient(te.clientConn())
tc := testgrpc.NewTestServiceClient(te.clientConn())
ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
defer cancel()
// Failure case, should not panic.
@ -4988,7 +4989,7 @@ func testSvrWriteStatusEarlyWrite(t *testing.T, e env) {
}
te.startServer(&testServer{security: e.security})
defer te.tearDown()
tc := testpb.NewTestServiceClient(te.clientConn())
tc := testgrpc.NewTestServiceClient(te.clientConn())
respParam := []*testpb.ResponseParameters{
{
Size: int32(smallSize),
@ -5067,7 +5068,7 @@ func testGetMethodConfigTD(t *testing.T, e env) {
ch <- sc
cc := te.clientConn()
tc := testpb.NewTestServiceClient(cc)
tc := testgrpc.NewTestServiceClient(cc)
ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
defer cancel()
// The following RPCs are expected to become non-fail-fast ones with 1ms deadline.
@ -5118,7 +5119,7 @@ func testServiceConfigWaitForReadyTD(t *testing.T, e env) {
ch <- sc
cc := te.clientConn()
tc := testpb.NewTestServiceClient(cc)
tc := testgrpc.NewTestServiceClient(cc)
ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
defer cancel()
// The following RPCs are expected to become non-fail-fast ones with 1ms deadline.
@ -5182,7 +5183,7 @@ func testServiceConfigTimeoutTD(t *testing.T, e env) {
ch <- sc
cc := te.clientConn()
tc := testpb.NewTestServiceClient(cc)
tc := testgrpc.NewTestServiceClient(cc)
// The following RPCs are expected to become non-fail-fast ones with 1ns deadline.
ctx, cancel := context.WithTimeout(context.Background(), time.Nanosecond)
if _, err := tc.EmptyCall(ctx, &testpb.Empty{}, grpc.WaitForReady(true)); status.Code(err) != codes.DeadlineExceeded {
@ -5272,7 +5273,7 @@ func testServiceConfigMaxMsgSizeTD(t *testing.T, e env) {
defer te1.tearDown()
ch1 <- sc
tc := testpb.NewTestServiceClient(te1.clientConn())
tc := testgrpc.NewTestServiceClient(te1.clientConn())
req := &testpb.SimpleRequest{
ResponseType: testpb.PayloadType_COMPRESSABLE,
@ -5334,7 +5335,7 @@ func testServiceConfigMaxMsgSizeTD(t *testing.T, e env) {
te2.startServer(&testServer{security: e.security})
defer te2.tearDown()
ch2 <- sc
tc = testpb.NewTestServiceClient(te2.clientConn())
tc = testgrpc.NewTestServiceClient(te2.clientConn())
// Test for unary RPC recv.
req.Payload = smallPayload
@ -5383,7 +5384,7 @@ func testServiceConfigMaxMsgSizeTD(t *testing.T, e env) {
te3.startServer(&testServer{security: e.security})
defer te3.tearDown()
ch3 <- sc
tc = testpb.NewTestServiceClient(te3.clientConn())
tc = testgrpc.NewTestServiceClient(te3.clientConn())
// Test for unary RPC recv.
req.Payload = smallPayload
@ -5544,7 +5545,7 @@ func (s) TestInterceptorCanAccessCallOptions(t *testing.T) {
grpc.WaitForReady(true),
grpc.MaxCallRecvMsgSize(1010),
}
tc := testpb.NewTestServiceClient(te.clientConn(grpc.WithDefaultCallOptions(defaults...)))
tc := testgrpc.NewTestServiceClient(te.clientConn(grpc.WithDefaultCallOptions(defaults...)))
var headers metadata.MD
var trailers metadata.MD
@ -5601,7 +5602,7 @@ func (s) TestServeExitsWhenListenerClosed(t *testing.T) {
s := grpc.NewServer()
defer s.Stop()
testpb.RegisterTestServiceServer(s, ss)
testgrpc.RegisterTestServiceServer(s, ss)
lis, err := net.Listen("tcp", "localhost:0")
if err != nil {
@ -5619,7 +5620,7 @@ func (s) TestServeExitsWhenListenerClosed(t *testing.T) {
t.Fatalf("Failed to dial server: %v", err)
}
defer cc.Close()
c := testpb.NewTestServiceClient(cc)
c := testgrpc.NewTestServiceClient(cc)
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
if _, err := c.EmptyCall(ctx, &testpb.Empty{}); err != nil {
@ -5720,7 +5721,7 @@ func testClientDoesntDeadlockWhileWritingErrornousLargeMessages(t *testing.T, e
te.maxServerReceiveMsgSize = &smallSize
te.startServer(&testServer{security: e.security})
defer te.tearDown()
tc := testpb.NewTestServiceClient(te.clientConn())
tc := testgrpc.NewTestServiceClient(te.clientConn())
payload, err := newPayload(testpb.PayloadType_COMPRESSABLE, 1048576)
if err != nil {
t.Fatal(err)
@ -5759,7 +5760,7 @@ func testRPCTimeout(t *testing.T, e env) {
defer te.tearDown()
cc := te.clientConn()
tc := testpb.NewTestServiceClient(cc)
tc := testgrpc.NewTestServiceClient(cc)
const argSize = 2718
const respSize = 314
@ -5796,7 +5797,7 @@ func (s) TestDisabledIOBuffers(t *testing.T) {
}
ss := &stubserver.StubServer{
FullDuplexCallF: func(stream testpb.TestService_FullDuplexCallServer) error {
FullDuplexCallF: func(stream testgrpc.TestService_FullDuplexCallServer) error {
for {
in, err := stream.Recv()
if err == io.EOF {
@ -5820,7 +5821,7 @@ func (s) TestDisabledIOBuffers(t *testing.T) {
}
s := grpc.NewServer(grpc.WriteBufferSize(0), grpc.ReadBufferSize(0))
testpb.RegisterTestServiceServer(s, ss)
testgrpc.RegisterTestServiceServer(s, ss)
lis, err := net.Listen("tcp", "localhost:0")
if err != nil {
@ -5838,7 +5839,7 @@ func (s) TestDisabledIOBuffers(t *testing.T) {
t.Fatalf("Failed to dial server")
}
defer cc.Close()
c := testpb.NewTestServiceClient(cc)
c := testgrpc.NewTestServiceClient(cc)
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
stream, err := c.FullDuplexCall(ctx, grpc.WaitForReady(true))
@ -5880,7 +5881,7 @@ func testServerMaxHeaderListSizeClientUserViolation(t *testing.T, e env) {
defer te.tearDown()
cc := te.clientConn()
tc := testpb.NewTestServiceClient(cc)
tc := testgrpc.NewTestServiceClient(cc)
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
metadata.AppendToOutgoingContext(ctx, "oversize", string(make([]byte, 216)))
@ -5912,7 +5913,7 @@ func testClientMaxHeaderListSizeServerUserViolation(t *testing.T, e env) {
defer te.tearDown()
cc := te.clientConn()
tc := testpb.NewTestServiceClient(cc)
tc := testgrpc.NewTestServiceClient(cc)
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
var err error
@ -5943,7 +5944,7 @@ func testServerMaxHeaderListSizeClientIntentionalViolation(t *testing.T, e env)
defer te.tearDown()
cc, dw := te.clientConnWithConnControl()
tc := &testServiceClientWrapper{TestServiceClient: testpb.NewTestServiceClient(cc)}
tc := &testServiceClientWrapper{TestServiceClient: testgrpc.NewTestServiceClient(cc)}
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
stream, err := tc.FullDuplexCall(ctx)
@ -5984,7 +5985,7 @@ func testClientMaxHeaderListSizeServerIntentionalViolation(t *testing.T, e env)
lw := te.startServerWithConnControl(&testServer{security: e.security, setHeaderOnly: true})
defer te.tearDown()
cc, _ := te.clientConnWithConnControl()
tc := &testServiceClientWrapper{TestServiceClient: testpb.NewTestServiceClient(cc)}
tc := &testServiceClientWrapper{TestServiceClient: testgrpc.NewTestServiceClient(cc)}
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
stream, err := tc.FullDuplexCall(ctx)
@ -6031,7 +6032,7 @@ func (s) TestNetPipeConn(t *testing.T) {
ts := &funcServer{unaryCall: func(ctx context.Context, in *testpb.SimpleRequest) (*testpb.SimpleResponse, error) {
return &testpb.SimpleResponse{}, nil
}}
testpb.RegisterTestServiceServer(s, ts)
testgrpc.RegisterTestServiceServer(s, ts)
go s.Serve(pl)
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
@ -6040,7 +6041,7 @@ func (s) TestNetPipeConn(t *testing.T) {
t.Fatalf("Error creating client: %v", err)
}
defer cc.Close()
client := testpb.NewTestServiceClient(cc)
client := testgrpc.NewTestServiceClient(cc)
if _, err := client.UnaryCall(ctx, &testpb.SimpleRequest{}); err != nil {
t.Fatalf("UnaryCall(_) = _, %v; want _, nil", err)
}
@ -6059,7 +6060,7 @@ func testLargeTimeout(t *testing.T, e env) {
ts := &funcServer{}
te.startServer(ts)
defer te.tearDown()
tc := testpb.NewTestServiceClient(te.clientConn())
tc := testgrpc.NewTestServiceClient(te.clientConn())
timeouts := []time.Duration{
time.Duration(math.MaxInt64), // will be (correctly) converted to
@ -6114,7 +6115,7 @@ func (s) TestRPCWaitsForResolver(t *testing.T) {
te.resolverScheme = r.Scheme()
cc := te.clientConn(grpc.WithResolvers(r))
tc := testpb.NewTestServiceClient(cc)
tc := testgrpc.NewTestServiceClient(cc)
ctx, cancel := context.WithTimeout(context.Background(), 500*time.Millisecond)
defer cancel()
@ -6146,7 +6147,11 @@ func (s) TestRPCWaitsForResolver(t *testing.T) {
// We wait a second before providing a service config and resolving
// addresses. So this will wait for that and then honor the
// maxRequestMessageBytes it contains.
if _, err := tc.UnaryCall(ctx, &testpb.SimpleRequest{ResponseType: testpb.PayloadType_UNCOMPRESSABLE}); status.Code(err) != codes.ResourceExhausted {
payload, err := newPayload(testpb.PayloadType_COMPRESSABLE, 1)
if err != nil {
t.Fatal(err)
}
if _, err := tc.UnaryCall(ctx, &testpb.SimpleRequest{Payload: payload}); status.Code(err) != codes.ResourceExhausted {
t.Fatalf("TestService/UnaryCall(_, _) = _, %v, want _, nil", err)
}
if got := ctx.Err(); got != nil {
@ -6331,7 +6336,7 @@ func (s) TestClientCancellationPropagatesUnary(t *testing.T) {
// all call options' after are executed.
func (s) TestCanceledRPCCallOptionRace(t *testing.T) {
ss := &stubserver.StubServer{
FullDuplexCallF: func(stream testpb.TestService_FullDuplexCallServer) error {
FullDuplexCallF: func(stream testgrpc.TestService_FullDuplexCallServer) error {
err := stream.Send(&testpb.StreamingOutputCallResponse{})
if err != nil {
return err
@ -6757,7 +6762,7 @@ func (s) TestUnexpectedEOF(t *testing.T) {
// frame sent, simultaneously.
func (s) TestRecvWhileReturningStatus(t *testing.T) {
ss := &stubserver.StubServer{
FullDuplexCallF: func(stream testpb.TestService_FullDuplexCallServer) error {
FullDuplexCallF: func(stream testgrpc.TestService_FullDuplexCallServer) error {
// The client never sends, so this Recv blocks until the server
// returns and causes stream operations to return errors.
go stream.Recv()
@ -6822,7 +6827,7 @@ func (s) TestGlobalBinaryLoggingOptions(t *testing.T) {
UnaryCallF: func(ctx context.Context, in *testpb.SimpleRequest) (*testpb.SimpleResponse, error) {
return &testpb.SimpleResponse{}, nil
},
FullDuplexCallF: func(stream testpb.TestService_FullDuplexCallServer) error {
FullDuplexCallF: func(stream testgrpc.TestService_FullDuplexCallServer) error {
for {
_, err := stream.Recv()
if err == io.EOF {

View File

@ -40,7 +40,9 @@ import (
"google.golang.org/grpc/resolver"
"google.golang.org/grpc/resolver/manual"
"google.golang.org/grpc/status"
testpb "google.golang.org/grpc/test/grpc_testing"
testgrpc "google.golang.org/grpc/interop/grpc_testing"
testpb "google.golang.org/grpc/interop/grpc_testing"
)
// TestGracefulClientOnGoAway attempts to ensure that when the server sends a
@ -62,7 +64,7 @@ func (s) TestGracefulClientOnGoAway(t *testing.T) {
s := grpc.NewServer(grpc.KeepaliveParams(keepalive.ServerParameters{MaxConnectionAge: maxConnAge}))
defer s.Stop()
testpb.RegisterTestServiceServer(s, ss)
testgrpc.RegisterTestServiceServer(s, ss)
lis, err := net.Listen("tcp", "localhost:0")
if err != nil {
@ -75,7 +77,7 @@ func (s) TestGracefulClientOnGoAway(t *testing.T) {
t.Fatalf("Failed to dial server: %v", err)
}
defer cc.Close()
c := testpb.NewTestServiceClient(cc)
c := testgrpc.NewTestServiceClient(cc)
endTime := time.Now().Add(testTime)
for time.Now().Before(endTime) {
@ -90,7 +92,7 @@ func (s) TestGracefulClientOnGoAway(t *testing.T) {
func (s) TestDetailedGoAwayErrorOnGracefulClosePropagatesToRPCError(t *testing.T) {
rpcDoneOnClient := make(chan struct{})
ss := &stubserver.StubServer{
FullDuplexCallF: func(stream testpb.TestService_FullDuplexCallServer) error {
FullDuplexCallF: func(stream testgrpc.TestService_FullDuplexCallServer) error {
<-rpcDoneOnClient
return status.Error(codes.Internal, "arbitrary status")
},
@ -130,7 +132,7 @@ func (s) TestDetailedGoAwayErrorOnAbruptClosePropagatesToRPCError(t *testing.T)
rpcDoneOnClient := make(chan struct{})
ss := &stubserver.StubServer{
FullDuplexCallF: func(stream testpb.TestService_FullDuplexCallServer) error {
FullDuplexCallF: func(stream testgrpc.TestService_FullDuplexCallServer) error {
<-rpcDoneOnClient
return status.Error(codes.Internal, "arbitrary status")
},
@ -180,7 +182,7 @@ func testClientConnCloseAfterGoAwayWithActiveStream(t *testing.T, e env) {
te.startServer(&testServer{security: e.security})
defer te.tearDown()
cc := te.clientConn()
tc := testpb.NewTestServiceClient(cc)
tc := testgrpc.NewTestServiceClient(cc)
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
@ -218,7 +220,7 @@ func testServerGoAway(t *testing.T, e env) {
defer te.tearDown()
cc := te.clientConn()
tc := testpb.NewTestServiceClient(cc)
tc := testgrpc.NewTestServiceClient(cc)
// Finish an RPC to make sure the connection is good.
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
@ -270,7 +272,7 @@ func testServerGoAwayPendingRPC(t *testing.T, e env) {
defer te.tearDown()
cc := te.clientConn()
tc := testpb.NewTestServiceClient(cc)
tc := testgrpc.NewTestServiceClient(cc)
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
stream, err := tc.FullDuplexCall(ctx, grpc.WaitForReady(true))
if err != nil {
@ -344,7 +346,7 @@ func testServerMultipleGoAwayPendingRPC(t *testing.T, e env) {
defer te.tearDown()
cc := te.clientConn()
tc := testpb.NewTestServiceClient(cc)
tc := testgrpc.NewTestServiceClient(cc)
ctx, cancel := context.WithCancel(context.Background())
stream, err := tc.FullDuplexCall(ctx, grpc.WaitForReady(true))
if err != nil {
@ -433,7 +435,7 @@ func testConcurrentClientConnCloseAndServerGoAway(t *testing.T, e env) {
defer te.tearDown()
cc := te.clientConn()
tc := testpb.NewTestServiceClient(cc)
tc := testgrpc.NewTestServiceClient(cc)
ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
defer cancel()
if _, err := tc.EmptyCall(ctx, &testpb.Empty{}, grpc.WaitForReady(true)); err != nil {
@ -472,7 +474,7 @@ func testConcurrentServerStopAndGoAway(t *testing.T, e env) {
defer te.tearDown()
cc := te.clientConn()
tc := testpb.NewTestServiceClient(cc)
tc := testgrpc.NewTestServiceClient(cc)
ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
defer cancel()
stream, err := tc.FullDuplexCall(ctx, grpc.WaitForReady(true))
@ -553,7 +555,7 @@ func (s) TestGoAwayThenClose(t *testing.T) {
unaryCall: func(ctx context.Context, in *testpb.SimpleRequest) (*testpb.SimpleResponse, error) {
return &testpb.SimpleResponse{}, nil
},
fullDuplexCall: func(stream testpb.TestService_FullDuplexCallServer) error {
fullDuplexCall: func(stream testgrpc.TestService_FullDuplexCallServer) error {
if err := stream.Send(&testpb.StreamingOutputCallResponse{}); err != nil {
t.Errorf("unexpected error from send: %v", err)
return err
@ -566,7 +568,7 @@ func (s) TestGoAwayThenClose(t *testing.T) {
return err
},
}
testpb.RegisterTestServiceServer(s1, ts)
testgrpc.RegisterTestServiceServer(s1, ts)
go s1.Serve(lis1)
conn2Established := grpcsync.NewEvent()
@ -576,7 +578,7 @@ func (s) TestGoAwayThenClose(t *testing.T) {
}
s2 := grpc.NewServer()
defer s2.Stop()
testpb.RegisterTestServiceServer(s2, ts)
testgrpc.RegisterTestServiceServer(s2, ts)
r := manual.NewBuilderWithScheme("whatever")
r.InitialState(resolver.State{Addresses: []resolver.Address{
@ -589,7 +591,7 @@ func (s) TestGoAwayThenClose(t *testing.T) {
}
defer cc.Close()
client := testpb.NewTestServiceClient(cc)
client := testgrpc.NewTestServiceClient(cc)
t.Log("Waiting for the ClientConn to enter READY state.")
state := cc.GetState()
@ -692,7 +694,7 @@ func (s) TestGoAwayStreamIDSmallerThanCreatedStreams(t *testing.T) {
}
ct := val.(*clientTester)
tc := testpb.NewTestServiceClient(cc)
tc := testgrpc.NewTestServiceClient(cc)
someStreamsCreated := grpcsync.NewEvent()
goAwayWritten := grpcsync.NewEvent()
go func() {

View File

@ -32,7 +32,9 @@ import (
"google.golang.org/grpc/credentials/insecure"
"google.golang.org/grpc/internal/stubserver"
"google.golang.org/grpc/status"
testpb "google.golang.org/grpc/test/grpc_testing"
testgrpc "google.golang.org/grpc/interop/grpc_testing"
testpb "google.golang.org/grpc/interop/grpc_testing"
)
type delayListener struct {
@ -111,7 +113,7 @@ func (s) TestGracefulStop(t *testing.T) {
d := func(ctx context.Context, _ string) (net.Conn, error) { return dlis.Dial(ctx) }
ss := &stubserver.StubServer{
FullDuplexCallF: func(stream testpb.TestService_FullDuplexCallServer) error {
FullDuplexCallF: func(stream testgrpc.TestService_FullDuplexCallServer) error {
_, err := stream.Recv()
if err != nil {
return err
@ -120,7 +122,7 @@ func (s) TestGracefulStop(t *testing.T) {
},
}
s := grpc.NewServer()
testpb.RegisterTestServiceServer(s, ss)
testgrpc.RegisterTestServiceServer(s, ss)
// 1. Start Server
wg := sync.WaitGroup{}
@ -152,7 +154,7 @@ func (s) TestGracefulStop(t *testing.T) {
if err != nil {
t.Fatalf("grpc.DialContext(_, %q, _) = %v", lis.Addr().String(), err)
}
client := testpb.NewTestServiceClient(cc)
client := testgrpc.NewTestServiceClient(cc)
defer cc.Close()
// 4. Send an RPC on the new connection.
@ -173,7 +175,7 @@ func (s) TestGracefulStopClosesConnAfterLastStream(t *testing.T) {
handlerCalled := make(chan struct{})
gracefulStopCalled := make(chan struct{})
ts := &funcServer{streamingInputCall: func(stream testpb.TestService_StreamingInputCallServer) error {
ts := &funcServer{streamingInputCall: func(stream testgrpc.TestService_StreamingInputCallServer) error {
close(handlerCalled) // Initiate call to GracefulStop.
<-gracefulStopCalled // Wait for GOAWAYs to be received by the client.
return nil

View File

@ -1,924 +0,0 @@
// Copyright 2017 gRPC authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// An integration test service that covers all the method signature permutations
// of unary/streaming requests/responses.
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.30.0
// protoc v4.22.0
// source: test/grpc_testing/test.proto
package grpc_testing
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
// The type of payload that should be returned.
type PayloadType int32
const (
// Compressable text format.
PayloadType_COMPRESSABLE PayloadType = 0
// Uncompressable binary format.
PayloadType_UNCOMPRESSABLE PayloadType = 1
// Randomly chosen from all other formats defined in this enum.
PayloadType_RANDOM PayloadType = 2
)
// Enum value maps for PayloadType.
var (
PayloadType_name = map[int32]string{
0: "COMPRESSABLE",
1: "UNCOMPRESSABLE",
2: "RANDOM",
}
PayloadType_value = map[string]int32{
"COMPRESSABLE": 0,
"UNCOMPRESSABLE": 1,
"RANDOM": 2,
}
)
func (x PayloadType) Enum() *PayloadType {
p := new(PayloadType)
*p = x
return p
}
func (x PayloadType) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (PayloadType) Descriptor() protoreflect.EnumDescriptor {
return file_test_grpc_testing_test_proto_enumTypes[0].Descriptor()
}
func (PayloadType) Type() protoreflect.EnumType {
return &file_test_grpc_testing_test_proto_enumTypes[0]
}
func (x PayloadType) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use PayloadType.Descriptor instead.
func (PayloadType) EnumDescriptor() ([]byte, []int) {
return file_test_grpc_testing_test_proto_rawDescGZIP(), []int{0}
}
type Empty struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *Empty) Reset() {
*x = Empty{}
if protoimpl.UnsafeEnabled {
mi := &file_test_grpc_testing_test_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Empty) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Empty) ProtoMessage() {}
func (x *Empty) ProtoReflect() protoreflect.Message {
mi := &file_test_grpc_testing_test_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Empty.ProtoReflect.Descriptor instead.
func (*Empty) Descriptor() ([]byte, []int) {
return file_test_grpc_testing_test_proto_rawDescGZIP(), []int{0}
}
// A block of data, to simply increase gRPC message size.
type Payload struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// The type of data in body.
Type PayloadType `protobuf:"varint,1,opt,name=type,proto3,enum=grpc.testing.PayloadType" json:"type,omitempty"`
// Primary contents of payload.
Body []byte `protobuf:"bytes,2,opt,name=body,proto3" json:"body,omitempty"`
}
func (x *Payload) Reset() {
*x = Payload{}
if protoimpl.UnsafeEnabled {
mi := &file_test_grpc_testing_test_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Payload) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Payload) ProtoMessage() {}
func (x *Payload) ProtoReflect() protoreflect.Message {
mi := &file_test_grpc_testing_test_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Payload.ProtoReflect.Descriptor instead.
func (*Payload) Descriptor() ([]byte, []int) {
return file_test_grpc_testing_test_proto_rawDescGZIP(), []int{1}
}
func (x *Payload) GetType() PayloadType {
if x != nil {
return x.Type
}
return PayloadType_COMPRESSABLE
}
func (x *Payload) GetBody() []byte {
if x != nil {
return x.Body
}
return nil
}
// Unary request.
type SimpleRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// Desired payload type in the response from the server.
// If response_type is RANDOM, server randomly chooses one from other formats.
ResponseType PayloadType `protobuf:"varint,1,opt,name=response_type,json=responseType,proto3,enum=grpc.testing.PayloadType" json:"response_type,omitempty"`
// Desired payload size in the response from the server.
// If response_type is COMPRESSABLE, this denotes the size before compression.
ResponseSize int32 `protobuf:"varint,2,opt,name=response_size,json=responseSize,proto3" json:"response_size,omitempty"`
// Optional input payload sent along with the request.
Payload *Payload `protobuf:"bytes,3,opt,name=payload,proto3" json:"payload,omitempty"`
// Whether SimpleResponse should include username.
FillUsername bool `protobuf:"varint,4,opt,name=fill_username,json=fillUsername,proto3" json:"fill_username,omitempty"`
// Whether SimpleResponse should include OAuth scope.
FillOauthScope bool `protobuf:"varint,5,opt,name=fill_oauth_scope,json=fillOauthScope,proto3" json:"fill_oauth_scope,omitempty"`
}
func (x *SimpleRequest) Reset() {
*x = SimpleRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_test_grpc_testing_test_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *SimpleRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SimpleRequest) ProtoMessage() {}
func (x *SimpleRequest) ProtoReflect() protoreflect.Message {
mi := &file_test_grpc_testing_test_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use SimpleRequest.ProtoReflect.Descriptor instead.
func (*SimpleRequest) Descriptor() ([]byte, []int) {
return file_test_grpc_testing_test_proto_rawDescGZIP(), []int{2}
}
func (x *SimpleRequest) GetResponseType() PayloadType {
if x != nil {
return x.ResponseType
}
return PayloadType_COMPRESSABLE
}
func (x *SimpleRequest) GetResponseSize() int32 {
if x != nil {
return x.ResponseSize
}
return 0
}
func (x *SimpleRequest) GetPayload() *Payload {
if x != nil {
return x.Payload
}
return nil
}
func (x *SimpleRequest) GetFillUsername() bool {
if x != nil {
return x.FillUsername
}
return false
}
func (x *SimpleRequest) GetFillOauthScope() bool {
if x != nil {
return x.FillOauthScope
}
return false
}
// Unary response, as configured by the request.
type SimpleResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// Payload to increase message size.
Payload *Payload `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"`
// The user the request came from, for verifying authentication was
// successful when the client expected it.
Username string `protobuf:"bytes,2,opt,name=username,proto3" json:"username,omitempty"`
// OAuth scope.
OauthScope string `protobuf:"bytes,3,opt,name=oauth_scope,json=oauthScope,proto3" json:"oauth_scope,omitempty"`
}
func (x *SimpleResponse) Reset() {
*x = SimpleResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_test_grpc_testing_test_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *SimpleResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SimpleResponse) ProtoMessage() {}
func (x *SimpleResponse) ProtoReflect() protoreflect.Message {
mi := &file_test_grpc_testing_test_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use SimpleResponse.ProtoReflect.Descriptor instead.
func (*SimpleResponse) Descriptor() ([]byte, []int) {
return file_test_grpc_testing_test_proto_rawDescGZIP(), []int{3}
}
func (x *SimpleResponse) GetPayload() *Payload {
if x != nil {
return x.Payload
}
return nil
}
func (x *SimpleResponse) GetUsername() string {
if x != nil {
return x.Username
}
return ""
}
func (x *SimpleResponse) GetOauthScope() string {
if x != nil {
return x.OauthScope
}
return ""
}
// Client-streaming request.
type StreamingInputCallRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// Optional input payload sent along with the request.
Payload *Payload `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"`
}
func (x *StreamingInputCallRequest) Reset() {
*x = StreamingInputCallRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_test_grpc_testing_test_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *StreamingInputCallRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*StreamingInputCallRequest) ProtoMessage() {}
func (x *StreamingInputCallRequest) ProtoReflect() protoreflect.Message {
mi := &file_test_grpc_testing_test_proto_msgTypes[4]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use StreamingInputCallRequest.ProtoReflect.Descriptor instead.
func (*StreamingInputCallRequest) Descriptor() ([]byte, []int) {
return file_test_grpc_testing_test_proto_rawDescGZIP(), []int{4}
}
func (x *StreamingInputCallRequest) GetPayload() *Payload {
if x != nil {
return x.Payload
}
return nil
}
// Client-streaming response.
type StreamingInputCallResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// Aggregated size of payloads received from the client.
AggregatedPayloadSize int32 `protobuf:"varint,1,opt,name=aggregated_payload_size,json=aggregatedPayloadSize,proto3" json:"aggregated_payload_size,omitempty"`
}
func (x *StreamingInputCallResponse) Reset() {
*x = StreamingInputCallResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_test_grpc_testing_test_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *StreamingInputCallResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*StreamingInputCallResponse) ProtoMessage() {}
func (x *StreamingInputCallResponse) ProtoReflect() protoreflect.Message {
mi := &file_test_grpc_testing_test_proto_msgTypes[5]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use StreamingInputCallResponse.ProtoReflect.Descriptor instead.
func (*StreamingInputCallResponse) Descriptor() ([]byte, []int) {
return file_test_grpc_testing_test_proto_rawDescGZIP(), []int{5}
}
func (x *StreamingInputCallResponse) GetAggregatedPayloadSize() int32 {
if x != nil {
return x.AggregatedPayloadSize
}
return 0
}
// Configuration for a particular response.
type ResponseParameters struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// Desired payload sizes in responses from the server.
// If response_type is COMPRESSABLE, this denotes the size before compression.
Size int32 `protobuf:"varint,1,opt,name=size,proto3" json:"size,omitempty"`
// Desired interval between consecutive responses in the response stream in
// microseconds.
IntervalUs int32 `protobuf:"varint,2,opt,name=interval_us,json=intervalUs,proto3" json:"interval_us,omitempty"`
}
func (x *ResponseParameters) Reset() {
*x = ResponseParameters{}
if protoimpl.UnsafeEnabled {
mi := &file_test_grpc_testing_test_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ResponseParameters) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ResponseParameters) ProtoMessage() {}
func (x *ResponseParameters) ProtoReflect() protoreflect.Message {
mi := &file_test_grpc_testing_test_proto_msgTypes[6]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ResponseParameters.ProtoReflect.Descriptor instead.
func (*ResponseParameters) Descriptor() ([]byte, []int) {
return file_test_grpc_testing_test_proto_rawDescGZIP(), []int{6}
}
func (x *ResponseParameters) GetSize() int32 {
if x != nil {
return x.Size
}
return 0
}
func (x *ResponseParameters) GetIntervalUs() int32 {
if x != nil {
return x.IntervalUs
}
return 0
}
// Server-streaming request.
type StreamingOutputCallRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// Desired payload type in the response from the server.
// If response_type is RANDOM, the payload from each response in the stream
// might be of different types. This is to simulate a mixed type of payload
// stream.
ResponseType PayloadType `protobuf:"varint,1,opt,name=response_type,json=responseType,proto3,enum=grpc.testing.PayloadType" json:"response_type,omitempty"`
// Configuration for each expected response message.
ResponseParameters []*ResponseParameters `protobuf:"bytes,2,rep,name=response_parameters,json=responseParameters,proto3" json:"response_parameters,omitempty"`
// Optional input payload sent along with the request.
Payload *Payload `protobuf:"bytes,3,opt,name=payload,proto3" json:"payload,omitempty"`
}
func (x *StreamingOutputCallRequest) Reset() {
*x = StreamingOutputCallRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_test_grpc_testing_test_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *StreamingOutputCallRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*StreamingOutputCallRequest) ProtoMessage() {}
func (x *StreamingOutputCallRequest) ProtoReflect() protoreflect.Message {
mi := &file_test_grpc_testing_test_proto_msgTypes[7]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use StreamingOutputCallRequest.ProtoReflect.Descriptor instead.
func (*StreamingOutputCallRequest) Descriptor() ([]byte, []int) {
return file_test_grpc_testing_test_proto_rawDescGZIP(), []int{7}
}
func (x *StreamingOutputCallRequest) GetResponseType() PayloadType {
if x != nil {
return x.ResponseType
}
return PayloadType_COMPRESSABLE
}
func (x *StreamingOutputCallRequest) GetResponseParameters() []*ResponseParameters {
if x != nil {
return x.ResponseParameters
}
return nil
}
func (x *StreamingOutputCallRequest) GetPayload() *Payload {
if x != nil {
return x.Payload
}
return nil
}
// Server-streaming response, as configured by the request and parameters.
type StreamingOutputCallResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// Payload to increase response size.
Payload *Payload `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"`
}
func (x *StreamingOutputCallResponse) Reset() {
*x = StreamingOutputCallResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_test_grpc_testing_test_proto_msgTypes[8]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *StreamingOutputCallResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*StreamingOutputCallResponse) ProtoMessage() {}
func (x *StreamingOutputCallResponse) ProtoReflect() protoreflect.Message {
mi := &file_test_grpc_testing_test_proto_msgTypes[8]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use StreamingOutputCallResponse.ProtoReflect.Descriptor instead.
func (*StreamingOutputCallResponse) Descriptor() ([]byte, []int) {
return file_test_grpc_testing_test_proto_rawDescGZIP(), []int{8}
}
func (x *StreamingOutputCallResponse) GetPayload() *Payload {
if x != nil {
return x.Payload
}
return nil
}
var File_test_grpc_testing_test_proto protoreflect.FileDescriptor
var file_test_grpc_testing_test_proto_rawDesc = []byte{
0x0a, 0x1c, 0x74, 0x65, 0x73, 0x74, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x5f, 0x74, 0x65, 0x73, 0x74,
0x69, 0x6e, 0x67, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c,
0x67, 0x72, 0x70, 0x63, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x22, 0x07, 0x0a, 0x05,
0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x4c, 0x0a, 0x07, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64,
0x12, 0x2d, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x19,
0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x50, 0x61,
0x79, 0x6c, 0x6f, 0x61, 0x64, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12,
0x12, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x62,
0x6f, 0x64, 0x79, 0x22, 0xf4, 0x01, 0x0a, 0x0d, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x52, 0x65,
0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3e, 0x0a, 0x0d, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x19, 0x2e, 0x67,
0x72, 0x70, 0x63, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x50, 0x61, 0x79, 0x6c,
0x6f, 0x61, 0x64, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0c, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x72, 0x65,
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x2f, 0x0a, 0x07, 0x70, 0x61,
0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x67, 0x72,
0x70, 0x63, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x50, 0x61, 0x79, 0x6c, 0x6f,
0x61, 0x64, 0x52, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x23, 0x0a, 0x0d, 0x66,
0x69, 0x6c, 0x6c, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01,
0x28, 0x08, 0x52, 0x0c, 0x66, 0x69, 0x6c, 0x6c, 0x55, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65,
0x12, 0x28, 0x0a, 0x10, 0x66, 0x69, 0x6c, 0x6c, 0x5f, 0x6f, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x73,
0x63, 0x6f, 0x70, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x66, 0x69, 0x6c, 0x6c,
0x4f, 0x61, 0x75, 0x74, 0x68, 0x53, 0x63, 0x6f, 0x70, 0x65, 0x22, 0x7e, 0x0a, 0x0e, 0x53, 0x69,
0x6d, 0x70, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2f, 0x0a, 0x07,
0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e,
0x67, 0x72, 0x70, 0x63, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x50, 0x61, 0x79,
0x6c, 0x6f, 0x61, 0x64, 0x52, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x1a, 0x0a,
0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x6f, 0x61, 0x75,
0x74, 0x68, 0x5f, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a,
0x6f, 0x61, 0x75, 0x74, 0x68, 0x53, 0x63, 0x6f, 0x70, 0x65, 0x22, 0x4c, 0x0a, 0x19, 0x53, 0x74,
0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x43, 0x61, 0x6c, 0x6c,
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2f, 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f,
0x61, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e,
0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x52,
0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x22, 0x54, 0x0a, 0x1a, 0x53, 0x74, 0x72, 0x65,
0x61, 0x6d, 0x69, 0x6e, 0x67, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x65,
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x36, 0x0a, 0x17, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67,
0x61, 0x74, 0x65, 0x64, 0x5f, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x73, 0x69, 0x7a,
0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x15, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61,
0x74, 0x65, 0x64, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x53, 0x69, 0x7a, 0x65, 0x22, 0x49,
0x0a, 0x12, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65,
0x74, 0x65, 0x72, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x01, 0x20, 0x01,
0x28, 0x05, 0x52, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x69, 0x6e, 0x74, 0x65,
0x72, 0x76, 0x61, 0x6c, 0x5f, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x69,
0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x55, 0x73, 0x22, 0xe0, 0x01, 0x0a, 0x1a, 0x53, 0x74,
0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x43, 0x61, 0x6c,
0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3e, 0x0a, 0x0d, 0x72, 0x65, 0x73, 0x70,
0x6f, 0x6e, 0x73, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32,
0x19, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x50,
0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0c, 0x72, 0x65, 0x73, 0x70,
0x6f, 0x6e, 0x73, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x51, 0x0a, 0x13, 0x72, 0x65, 0x73, 0x70,
0x6f, 0x6e, 0x73, 0x65, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x18,
0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x74, 0x65, 0x73,
0x74, 0x69, 0x6e, 0x67, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x50, 0x61, 0x72,
0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x52, 0x12, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x12, 0x2f, 0x0a, 0x07, 0x70,
0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x67,
0x72, 0x70, 0x63, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x50, 0x61, 0x79, 0x6c,
0x6f, 0x61, 0x64, 0x52, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x22, 0x4e, 0x0a, 0x1b,
0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x43,
0x61, 0x6c, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2f, 0x0a, 0x07, 0x70,
0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x67,
0x72, 0x70, 0x63, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x50, 0x61, 0x79, 0x6c,
0x6f, 0x61, 0x64, 0x52, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x2a, 0x3f, 0x0a, 0x0b,
0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x54, 0x79, 0x70, 0x65, 0x12, 0x10, 0x0a, 0x0c, 0x43,
0x4f, 0x4d, 0x50, 0x52, 0x45, 0x53, 0x53, 0x41, 0x42, 0x4c, 0x45, 0x10, 0x00, 0x12, 0x12, 0x0a,
0x0e, 0x55, 0x4e, 0x43, 0x4f, 0x4d, 0x50, 0x52, 0x45, 0x53, 0x53, 0x41, 0x42, 0x4c, 0x45, 0x10,
0x01, 0x12, 0x0a, 0x0a, 0x06, 0x52, 0x41, 0x4e, 0x44, 0x4f, 0x4d, 0x10, 0x02, 0x32, 0xbb, 0x04,
0x0a, 0x0b, 0x54, 0x65, 0x73, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x35, 0x0a,
0x09, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x43, 0x61, 0x6c, 0x6c, 0x12, 0x13, 0x2e, 0x67, 0x72, 0x70,
0x63, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a,
0x13, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x45,
0x6d, 0x70, 0x74, 0x79, 0x12, 0x46, 0x0a, 0x09, 0x55, 0x6e, 0x61, 0x72, 0x79, 0x43, 0x61, 0x6c,
0x6c, 0x12, 0x1b, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67,
0x2e, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c,
0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x53, 0x69,
0x6d, 0x70, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x6c, 0x0a, 0x13,
0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x43,
0x61, 0x6c, 0x6c, 0x12, 0x28, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69,
0x6e, 0x67, 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x4f, 0x75, 0x74, 0x70,
0x75, 0x74, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e,
0x67, 0x72, 0x70, 0x63, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x53, 0x74, 0x72,
0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x43, 0x61, 0x6c, 0x6c,
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, 0x69, 0x0a, 0x12, 0x53, 0x74,
0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x43, 0x61, 0x6c, 0x6c,
0x12, 0x27, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e,
0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x43, 0x61,
0x6c, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x28, 0x2e, 0x67, 0x72, 0x70, 0x63,
0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69,
0x6e, 0x67, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f,
0x6e, 0x73, 0x65, 0x28, 0x01, 0x12, 0x69, 0x0a, 0x0e, 0x46, 0x75, 0x6c, 0x6c, 0x44, 0x75, 0x70,
0x6c, 0x65, 0x78, 0x43, 0x61, 0x6c, 0x6c, 0x12, 0x28, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x74,
0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67,
0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x74, 0x1a, 0x29, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67,
0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74,
0x43, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x28, 0x01, 0x30, 0x01,
0x12, 0x69, 0x0a, 0x0e, 0x48, 0x61, 0x6c, 0x66, 0x44, 0x75, 0x70, 0x6c, 0x65, 0x78, 0x43, 0x61,
0x6c, 0x6c, 0x12, 0x28, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e,
0x67, 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x4f, 0x75, 0x74, 0x70, 0x75,
0x74, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x67,
0x72, 0x70, 0x63, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x53, 0x74, 0x72, 0x65,
0x61, 0x6d, 0x69, 0x6e, 0x67, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x43, 0x61, 0x6c, 0x6c, 0x52,
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x28, 0x01, 0x30, 0x01, 0x42, 0x2a, 0x5a, 0x28, 0x67,
0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2e, 0x6f, 0x72, 0x67,
0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x5f,
0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_test_grpc_testing_test_proto_rawDescOnce sync.Once
file_test_grpc_testing_test_proto_rawDescData = file_test_grpc_testing_test_proto_rawDesc
)
func file_test_grpc_testing_test_proto_rawDescGZIP() []byte {
file_test_grpc_testing_test_proto_rawDescOnce.Do(func() {
file_test_grpc_testing_test_proto_rawDescData = protoimpl.X.CompressGZIP(file_test_grpc_testing_test_proto_rawDescData)
})
return file_test_grpc_testing_test_proto_rawDescData
}
var file_test_grpc_testing_test_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_test_grpc_testing_test_proto_msgTypes = make([]protoimpl.MessageInfo, 9)
var file_test_grpc_testing_test_proto_goTypes = []interface{}{
(PayloadType)(0), // 0: grpc.testing.PayloadType
(*Empty)(nil), // 1: grpc.testing.Empty
(*Payload)(nil), // 2: grpc.testing.Payload
(*SimpleRequest)(nil), // 3: grpc.testing.SimpleRequest
(*SimpleResponse)(nil), // 4: grpc.testing.SimpleResponse
(*StreamingInputCallRequest)(nil), // 5: grpc.testing.StreamingInputCallRequest
(*StreamingInputCallResponse)(nil), // 6: grpc.testing.StreamingInputCallResponse
(*ResponseParameters)(nil), // 7: grpc.testing.ResponseParameters
(*StreamingOutputCallRequest)(nil), // 8: grpc.testing.StreamingOutputCallRequest
(*StreamingOutputCallResponse)(nil), // 9: grpc.testing.StreamingOutputCallResponse
}
var file_test_grpc_testing_test_proto_depIdxs = []int32{
0, // 0: grpc.testing.Payload.type:type_name -> grpc.testing.PayloadType
0, // 1: grpc.testing.SimpleRequest.response_type:type_name -> grpc.testing.PayloadType
2, // 2: grpc.testing.SimpleRequest.payload:type_name -> grpc.testing.Payload
2, // 3: grpc.testing.SimpleResponse.payload:type_name -> grpc.testing.Payload
2, // 4: grpc.testing.StreamingInputCallRequest.payload:type_name -> grpc.testing.Payload
0, // 5: grpc.testing.StreamingOutputCallRequest.response_type:type_name -> grpc.testing.PayloadType
7, // 6: grpc.testing.StreamingOutputCallRequest.response_parameters:type_name -> grpc.testing.ResponseParameters
2, // 7: grpc.testing.StreamingOutputCallRequest.payload:type_name -> grpc.testing.Payload
2, // 8: grpc.testing.StreamingOutputCallResponse.payload:type_name -> grpc.testing.Payload
1, // 9: grpc.testing.TestService.EmptyCall:input_type -> grpc.testing.Empty
3, // 10: grpc.testing.TestService.UnaryCall:input_type -> grpc.testing.SimpleRequest
8, // 11: grpc.testing.TestService.StreamingOutputCall:input_type -> grpc.testing.StreamingOutputCallRequest
5, // 12: grpc.testing.TestService.StreamingInputCall:input_type -> grpc.testing.StreamingInputCallRequest
8, // 13: grpc.testing.TestService.FullDuplexCall:input_type -> grpc.testing.StreamingOutputCallRequest
8, // 14: grpc.testing.TestService.HalfDuplexCall:input_type -> grpc.testing.StreamingOutputCallRequest
1, // 15: grpc.testing.TestService.EmptyCall:output_type -> grpc.testing.Empty
4, // 16: grpc.testing.TestService.UnaryCall:output_type -> grpc.testing.SimpleResponse
9, // 17: grpc.testing.TestService.StreamingOutputCall:output_type -> grpc.testing.StreamingOutputCallResponse
6, // 18: grpc.testing.TestService.StreamingInputCall:output_type -> grpc.testing.StreamingInputCallResponse
9, // 19: grpc.testing.TestService.FullDuplexCall:output_type -> grpc.testing.StreamingOutputCallResponse
9, // 20: grpc.testing.TestService.HalfDuplexCall:output_type -> grpc.testing.StreamingOutputCallResponse
15, // [15:21] is the sub-list for method output_type
9, // [9:15] is the sub-list for method input_type
9, // [9:9] is the sub-list for extension type_name
9, // [9:9] is the sub-list for extension extendee
0, // [0:9] is the sub-list for field type_name
}
func init() { file_test_grpc_testing_test_proto_init() }
func file_test_grpc_testing_test_proto_init() {
if File_test_grpc_testing_test_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_test_grpc_testing_test_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Empty); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_test_grpc_testing_test_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Payload); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_test_grpc_testing_test_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SimpleRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_test_grpc_testing_test_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SimpleResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_test_grpc_testing_test_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*StreamingInputCallRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_test_grpc_testing_test_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*StreamingInputCallResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_test_grpc_testing_test_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ResponseParameters); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_test_grpc_testing_test_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*StreamingOutputCallRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_test_grpc_testing_test_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*StreamingOutputCallResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_test_grpc_testing_test_proto_rawDesc,
NumEnums: 1,
NumMessages: 9,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_test_grpc_testing_test_proto_goTypes,
DependencyIndexes: file_test_grpc_testing_test_proto_depIdxs,
EnumInfos: file_test_grpc_testing_test_proto_enumTypes,
MessageInfos: file_test_grpc_testing_test_proto_msgTypes,
}.Build()
File_test_grpc_testing_test_proto = out.File
file_test_grpc_testing_test_proto_rawDesc = nil
file_test_grpc_testing_test_proto_goTypes = nil
file_test_grpc_testing_test_proto_depIdxs = nil
}

View File

@ -1,156 +0,0 @@
// Copyright 2017 gRPC authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// An integration test service that covers all the method signature permutations
// of unary/streaming requests/responses.
syntax = "proto3";
option go_package = "google.golang.org/grpc/test/grpc_testing";
package grpc.testing;
message Empty {}
// The type of payload that should be returned.
enum PayloadType {
// Compressable text format.
COMPRESSABLE = 0;
// Uncompressable binary format.
UNCOMPRESSABLE = 1;
// Randomly chosen from all other formats defined in this enum.
RANDOM = 2;
}
// A block of data, to simply increase gRPC message size.
message Payload {
// The type of data in body.
PayloadType type = 1;
// Primary contents of payload.
bytes body = 2;
}
// Unary request.
message SimpleRequest {
// Desired payload type in the response from the server.
// If response_type is RANDOM, server randomly chooses one from other formats.
PayloadType response_type = 1;
// Desired payload size in the response from the server.
// If response_type is COMPRESSABLE, this denotes the size before compression.
int32 response_size = 2;
// Optional input payload sent along with the request.
Payload payload = 3;
// Whether SimpleResponse should include username.
bool fill_username = 4;
// Whether SimpleResponse should include OAuth scope.
bool fill_oauth_scope = 5;
}
// Unary response, as configured by the request.
message SimpleResponse {
// Payload to increase message size.
Payload payload = 1;
// The user the request came from, for verifying authentication was
// successful when the client expected it.
string username = 2;
// OAuth scope.
string oauth_scope = 3;
}
// Client-streaming request.
message StreamingInputCallRequest {
// Optional input payload sent along with the request.
Payload payload = 1;
// Not expecting any payload from the response.
}
// Client-streaming response.
message StreamingInputCallResponse {
// Aggregated size of payloads received from the client.
int32 aggregated_payload_size = 1;
}
// Configuration for a particular response.
message ResponseParameters {
// Desired payload sizes in responses from the server.
// If response_type is COMPRESSABLE, this denotes the size before compression.
int32 size = 1;
// Desired interval between consecutive responses in the response stream in
// microseconds.
int32 interval_us = 2;
}
// Server-streaming request.
message StreamingOutputCallRequest {
// Desired payload type in the response from the server.
// If response_type is RANDOM, the payload from each response in the stream
// might be of different types. This is to simulate a mixed type of payload
// stream.
PayloadType response_type = 1;
// Configuration for each expected response message.
repeated ResponseParameters response_parameters = 2;
// Optional input payload sent along with the request.
Payload payload = 3;
}
// Server-streaming response, as configured by the request and parameters.
message StreamingOutputCallResponse {
// Payload to increase response size.
Payload payload = 1;
}
// A simple service to test the various types of RPCs and experiment with
// performance with various types of payload.
service TestService {
// One empty request followed by one empty response.
rpc EmptyCall(Empty) returns (Empty);
// One request followed by one response.
// The server returns the client payload as-is.
rpc UnaryCall(SimpleRequest) returns (SimpleResponse);
// One request followed by a sequence of responses (streamed download).
// The server returns the payload with client desired type and sizes.
rpc StreamingOutputCall(StreamingOutputCallRequest)
returns (stream StreamingOutputCallResponse);
// A sequence of requests followed by one response (streamed upload).
// The server returns the aggregated size of client payload as the result.
rpc StreamingInputCall(stream StreamingInputCallRequest)
returns (StreamingInputCallResponse);
// A sequence of requests with each request served by the server immediately.
// As one request could lead to multiple responses, this interface
// demonstrates the idea of full duplexing.
rpc FullDuplexCall(stream StreamingOutputCallRequest)
returns (stream StreamingOutputCallResponse);
// A sequence of requests followed by a sequence of responses.
// The server buffers all the client requests and then serves them in order. A
// stream of responses are returned to the client when the server starts with
// first request.
rpc HalfDuplexCall(stream StreamingOutputCallRequest)
returns (stream StreamingOutputCallResponse);
}

View File

@ -1,465 +0,0 @@
// Copyright 2017 gRPC authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// An integration test service that covers all the method signature permutations
// of unary/streaming requests/responses.
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.3.0
// - protoc v4.22.0
// source: test/grpc_testing/test.proto
package grpc_testing
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
const (
TestService_EmptyCall_FullMethodName = "/grpc.testing.TestService/EmptyCall"
TestService_UnaryCall_FullMethodName = "/grpc.testing.TestService/UnaryCall"
TestService_StreamingOutputCall_FullMethodName = "/grpc.testing.TestService/StreamingOutputCall"
TestService_StreamingInputCall_FullMethodName = "/grpc.testing.TestService/StreamingInputCall"
TestService_FullDuplexCall_FullMethodName = "/grpc.testing.TestService/FullDuplexCall"
TestService_HalfDuplexCall_FullMethodName = "/grpc.testing.TestService/HalfDuplexCall"
)
// TestServiceClient is the client API for TestService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type TestServiceClient interface {
// One empty request followed by one empty response.
EmptyCall(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Empty, error)
// One request followed by one response.
// The server returns the client payload as-is.
UnaryCall(ctx context.Context, in *SimpleRequest, opts ...grpc.CallOption) (*SimpleResponse, error)
// One request followed by a sequence of responses (streamed download).
// The server returns the payload with client desired type and sizes.
StreamingOutputCall(ctx context.Context, in *StreamingOutputCallRequest, opts ...grpc.CallOption) (TestService_StreamingOutputCallClient, error)
// A sequence of requests followed by one response (streamed upload).
// The server returns the aggregated size of client payload as the result.
StreamingInputCall(ctx context.Context, opts ...grpc.CallOption) (TestService_StreamingInputCallClient, error)
// A sequence of requests with each request served by the server immediately.
// As one request could lead to multiple responses, this interface
// demonstrates the idea of full duplexing.
FullDuplexCall(ctx context.Context, opts ...grpc.CallOption) (TestService_FullDuplexCallClient, error)
// A sequence of requests followed by a sequence of responses.
// The server buffers all the client requests and then serves them in order. A
// stream of responses are returned to the client when the server starts with
// first request.
HalfDuplexCall(ctx context.Context, opts ...grpc.CallOption) (TestService_HalfDuplexCallClient, error)
}
type testServiceClient struct {
cc grpc.ClientConnInterface
}
func NewTestServiceClient(cc grpc.ClientConnInterface) TestServiceClient {
return &testServiceClient{cc}
}
func (c *testServiceClient) EmptyCall(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Empty, error) {
out := new(Empty)
err := c.cc.Invoke(ctx, TestService_EmptyCall_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *testServiceClient) UnaryCall(ctx context.Context, in *SimpleRequest, opts ...grpc.CallOption) (*SimpleResponse, error) {
out := new(SimpleResponse)
err := c.cc.Invoke(ctx, TestService_UnaryCall_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *testServiceClient) StreamingOutputCall(ctx context.Context, in *StreamingOutputCallRequest, opts ...grpc.CallOption) (TestService_StreamingOutputCallClient, error) {
stream, err := c.cc.NewStream(ctx, &TestService_ServiceDesc.Streams[0], TestService_StreamingOutputCall_FullMethodName, opts...)
if err != nil {
return nil, err
}
x := &testServiceStreamingOutputCallClient{stream}
if err := x.ClientStream.SendMsg(in); err != nil {
return nil, err
}
if err := x.ClientStream.CloseSend(); err != nil {
return nil, err
}
return x, nil
}
type TestService_StreamingOutputCallClient interface {
Recv() (*StreamingOutputCallResponse, error)
grpc.ClientStream
}
type testServiceStreamingOutputCallClient struct {
grpc.ClientStream
}
func (x *testServiceStreamingOutputCallClient) Recv() (*StreamingOutputCallResponse, error) {
m := new(StreamingOutputCallResponse)
if err := x.ClientStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
func (c *testServiceClient) StreamingInputCall(ctx context.Context, opts ...grpc.CallOption) (TestService_StreamingInputCallClient, error) {
stream, err := c.cc.NewStream(ctx, &TestService_ServiceDesc.Streams[1], TestService_StreamingInputCall_FullMethodName, opts...)
if err != nil {
return nil, err
}
x := &testServiceStreamingInputCallClient{stream}
return x, nil
}
type TestService_StreamingInputCallClient interface {
Send(*StreamingInputCallRequest) error
CloseAndRecv() (*StreamingInputCallResponse, error)
grpc.ClientStream
}
type testServiceStreamingInputCallClient struct {
grpc.ClientStream
}
func (x *testServiceStreamingInputCallClient) Send(m *StreamingInputCallRequest) error {
return x.ClientStream.SendMsg(m)
}
func (x *testServiceStreamingInputCallClient) CloseAndRecv() (*StreamingInputCallResponse, error) {
if err := x.ClientStream.CloseSend(); err != nil {
return nil, err
}
m := new(StreamingInputCallResponse)
if err := x.ClientStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
func (c *testServiceClient) FullDuplexCall(ctx context.Context, opts ...grpc.CallOption) (TestService_FullDuplexCallClient, error) {
stream, err := c.cc.NewStream(ctx, &TestService_ServiceDesc.Streams[2], TestService_FullDuplexCall_FullMethodName, opts...)
if err != nil {
return nil, err
}
x := &testServiceFullDuplexCallClient{stream}
return x, nil
}
type TestService_FullDuplexCallClient interface {
Send(*StreamingOutputCallRequest) error
Recv() (*StreamingOutputCallResponse, error)
grpc.ClientStream
}
type testServiceFullDuplexCallClient struct {
grpc.ClientStream
}
func (x *testServiceFullDuplexCallClient) Send(m *StreamingOutputCallRequest) error {
return x.ClientStream.SendMsg(m)
}
func (x *testServiceFullDuplexCallClient) Recv() (*StreamingOutputCallResponse, error) {
m := new(StreamingOutputCallResponse)
if err := x.ClientStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
func (c *testServiceClient) HalfDuplexCall(ctx context.Context, opts ...grpc.CallOption) (TestService_HalfDuplexCallClient, error) {
stream, err := c.cc.NewStream(ctx, &TestService_ServiceDesc.Streams[3], TestService_HalfDuplexCall_FullMethodName, opts...)
if err != nil {
return nil, err
}
x := &testServiceHalfDuplexCallClient{stream}
return x, nil
}
type TestService_HalfDuplexCallClient interface {
Send(*StreamingOutputCallRequest) error
Recv() (*StreamingOutputCallResponse, error)
grpc.ClientStream
}
type testServiceHalfDuplexCallClient struct {
grpc.ClientStream
}
func (x *testServiceHalfDuplexCallClient) Send(m *StreamingOutputCallRequest) error {
return x.ClientStream.SendMsg(m)
}
func (x *testServiceHalfDuplexCallClient) Recv() (*StreamingOutputCallResponse, error) {
m := new(StreamingOutputCallResponse)
if err := x.ClientStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
// TestServiceServer is the server API for TestService service.
// All implementations must embed UnimplementedTestServiceServer
// for forward compatibility
type TestServiceServer interface {
// One empty request followed by one empty response.
EmptyCall(context.Context, *Empty) (*Empty, error)
// One request followed by one response.
// The server returns the client payload as-is.
UnaryCall(context.Context, *SimpleRequest) (*SimpleResponse, error)
// One request followed by a sequence of responses (streamed download).
// The server returns the payload with client desired type and sizes.
StreamingOutputCall(*StreamingOutputCallRequest, TestService_StreamingOutputCallServer) error
// A sequence of requests followed by one response (streamed upload).
// The server returns the aggregated size of client payload as the result.
StreamingInputCall(TestService_StreamingInputCallServer) error
// A sequence of requests with each request served by the server immediately.
// As one request could lead to multiple responses, this interface
// demonstrates the idea of full duplexing.
FullDuplexCall(TestService_FullDuplexCallServer) error
// A sequence of requests followed by a sequence of responses.
// The server buffers all the client requests and then serves them in order. A
// stream of responses are returned to the client when the server starts with
// first request.
HalfDuplexCall(TestService_HalfDuplexCallServer) error
mustEmbedUnimplementedTestServiceServer()
}
// UnimplementedTestServiceServer must be embedded to have forward compatible implementations.
type UnimplementedTestServiceServer struct {
}
func (UnimplementedTestServiceServer) EmptyCall(context.Context, *Empty) (*Empty, error) {
return nil, status.Errorf(codes.Unimplemented, "method EmptyCall not implemented")
}
func (UnimplementedTestServiceServer) UnaryCall(context.Context, *SimpleRequest) (*SimpleResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UnaryCall not implemented")
}
func (UnimplementedTestServiceServer) StreamingOutputCall(*StreamingOutputCallRequest, TestService_StreamingOutputCallServer) error {
return status.Errorf(codes.Unimplemented, "method StreamingOutputCall not implemented")
}
func (UnimplementedTestServiceServer) StreamingInputCall(TestService_StreamingInputCallServer) error {
return status.Errorf(codes.Unimplemented, "method StreamingInputCall not implemented")
}
func (UnimplementedTestServiceServer) FullDuplexCall(TestService_FullDuplexCallServer) error {
return status.Errorf(codes.Unimplemented, "method FullDuplexCall not implemented")
}
func (UnimplementedTestServiceServer) HalfDuplexCall(TestService_HalfDuplexCallServer) error {
return status.Errorf(codes.Unimplemented, "method HalfDuplexCall not implemented")
}
func (UnimplementedTestServiceServer) mustEmbedUnimplementedTestServiceServer() {}
// UnsafeTestServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to TestServiceServer will
// result in compilation errors.
type UnsafeTestServiceServer interface {
mustEmbedUnimplementedTestServiceServer()
}
func RegisterTestServiceServer(s grpc.ServiceRegistrar, srv TestServiceServer) {
s.RegisterService(&TestService_ServiceDesc, srv)
}
func _TestService_EmptyCall_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(Empty)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(TestServiceServer).EmptyCall(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: TestService_EmptyCall_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(TestServiceServer).EmptyCall(ctx, req.(*Empty))
}
return interceptor(ctx, in, info, handler)
}
func _TestService_UnaryCall_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(SimpleRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(TestServiceServer).UnaryCall(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: TestService_UnaryCall_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(TestServiceServer).UnaryCall(ctx, req.(*SimpleRequest))
}
return interceptor(ctx, in, info, handler)
}
func _TestService_StreamingOutputCall_Handler(srv interface{}, stream grpc.ServerStream) error {
m := new(StreamingOutputCallRequest)
if err := stream.RecvMsg(m); err != nil {
return err
}
return srv.(TestServiceServer).StreamingOutputCall(m, &testServiceStreamingOutputCallServer{stream})
}
type TestService_StreamingOutputCallServer interface {
Send(*StreamingOutputCallResponse) error
grpc.ServerStream
}
type testServiceStreamingOutputCallServer struct {
grpc.ServerStream
}
func (x *testServiceStreamingOutputCallServer) Send(m *StreamingOutputCallResponse) error {
return x.ServerStream.SendMsg(m)
}
func _TestService_StreamingInputCall_Handler(srv interface{}, stream grpc.ServerStream) error {
return srv.(TestServiceServer).StreamingInputCall(&testServiceStreamingInputCallServer{stream})
}
type TestService_StreamingInputCallServer interface {
SendAndClose(*StreamingInputCallResponse) error
Recv() (*StreamingInputCallRequest, error)
grpc.ServerStream
}
type testServiceStreamingInputCallServer struct {
grpc.ServerStream
}
func (x *testServiceStreamingInputCallServer) SendAndClose(m *StreamingInputCallResponse) error {
return x.ServerStream.SendMsg(m)
}
func (x *testServiceStreamingInputCallServer) Recv() (*StreamingInputCallRequest, error) {
m := new(StreamingInputCallRequest)
if err := x.ServerStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
func _TestService_FullDuplexCall_Handler(srv interface{}, stream grpc.ServerStream) error {
return srv.(TestServiceServer).FullDuplexCall(&testServiceFullDuplexCallServer{stream})
}
type TestService_FullDuplexCallServer interface {
Send(*StreamingOutputCallResponse) error
Recv() (*StreamingOutputCallRequest, error)
grpc.ServerStream
}
type testServiceFullDuplexCallServer struct {
grpc.ServerStream
}
func (x *testServiceFullDuplexCallServer) Send(m *StreamingOutputCallResponse) error {
return x.ServerStream.SendMsg(m)
}
func (x *testServiceFullDuplexCallServer) Recv() (*StreamingOutputCallRequest, error) {
m := new(StreamingOutputCallRequest)
if err := x.ServerStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
func _TestService_HalfDuplexCall_Handler(srv interface{}, stream grpc.ServerStream) error {
return srv.(TestServiceServer).HalfDuplexCall(&testServiceHalfDuplexCallServer{stream})
}
type TestService_HalfDuplexCallServer interface {
Send(*StreamingOutputCallResponse) error
Recv() (*StreamingOutputCallRequest, error)
grpc.ServerStream
}
type testServiceHalfDuplexCallServer struct {
grpc.ServerStream
}
func (x *testServiceHalfDuplexCallServer) Send(m *StreamingOutputCallResponse) error {
return x.ServerStream.SendMsg(m)
}
func (x *testServiceHalfDuplexCallServer) Recv() (*StreamingOutputCallRequest, error) {
m := new(StreamingOutputCallRequest)
if err := x.ServerStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
// TestService_ServiceDesc is the grpc.ServiceDesc for TestService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var TestService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "grpc.testing.TestService",
HandlerType: (*TestServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "EmptyCall",
Handler: _TestService_EmptyCall_Handler,
},
{
MethodName: "UnaryCall",
Handler: _TestService_UnaryCall_Handler,
},
},
Streams: []grpc.StreamDesc{
{
StreamName: "StreamingOutputCall",
Handler: _TestService_StreamingOutputCall_Handler,
ServerStreams: true,
},
{
StreamName: "StreamingInputCall",
Handler: _TestService_StreamingInputCall_Handler,
ClientStreams: true,
},
{
StreamName: "FullDuplexCall",
Handler: _TestService_FullDuplexCall_Handler,
ServerStreams: true,
ClientStreams: true,
},
{
StreamName: "HalfDuplexCall",
Handler: _TestService_HalfDuplexCall_Handler,
ServerStreams: true,
ClientStreams: true,
},
},
Metadata: "test/grpc_testing/test.proto",
}

View File

@ -32,15 +32,17 @@ import (
"google.golang.org/grpc/connectivity"
"google.golang.org/grpc/credentials/insecure"
"google.golang.org/grpc/health"
healthgrpc "google.golang.org/grpc/health/grpc_health_v1"
healthpb "google.golang.org/grpc/health/grpc_health_v1"
"google.golang.org/grpc/internal"
"google.golang.org/grpc/internal/channelz"
"google.golang.org/grpc/internal/grpctest"
"google.golang.org/grpc/resolver"
"google.golang.org/grpc/resolver/manual"
"google.golang.org/grpc/status"
testpb "google.golang.org/grpc/test/grpc_testing"
healthgrpc "google.golang.org/grpc/health/grpc_health_v1"
healthpb "google.golang.org/grpc/health/grpc_health_v1"
testgrpc "google.golang.org/grpc/interop/grpc_testing"
testpb "google.golang.org/grpc/interop/grpc_testing"
)
var testHealthCheckFunc = internal.HealthCheckFunc
@ -143,7 +145,7 @@ func setupServer(t *testing.T, watchFunc healthWatchFunc) (*grpc.Server, net.Lis
}
s := grpc.NewServer()
healthgrpc.RegisterHealthServer(s, ts)
testpb.RegisterTestServiceServer(s, &testServer{})
testgrpc.RegisterTestServiceServer(s, &testServer{})
go s.Serve(lis)
t.Cleanup(func() { s.Stop() })
return s, lis, ts
@ -295,7 +297,7 @@ func (s) TestHealthCheckWithGoAway(t *testing.T) {
hcEnterChan, hcExitChan, testHealthCheckFuncWrapper := setupHealthCheckWrapper()
cc, r := setupClient(t, &clientConfig{testHealthCheckFuncWrapper: testHealthCheckFuncWrapper})
tc := testpb.NewTestServiceClient(cc)
tc := testgrpc.NewTestServiceClient(cc)
r.UpdateState(resolver.State{
Addresses: []resolver.Address{{Addr: lis.Addr().String()}},
ServiceConfig: parseServiceConfig(t, r, `{
@ -373,7 +375,7 @@ func (s) TestHealthCheckWithConnClose(t *testing.T) {
hcEnterChan, hcExitChan, testHealthCheckFuncWrapper := setupHealthCheckWrapper()
cc, r := setupClient(t, &clientConfig{testHealthCheckFuncWrapper: testHealthCheckFuncWrapper})
tc := testpb.NewTestServiceClient(cc)
tc := testgrpc.NewTestServiceClient(cc)
r.UpdateState(resolver.State{
Addresses: []resolver.Address{{Addr: lis.Addr().String()}},
ServiceConfig: parseServiceConfig(t, r, `{
@ -423,7 +425,7 @@ func (s) TestHealthCheckWithAddrConnDrain(t *testing.T) {
hcEnterChan, hcExitChan, testHealthCheckFuncWrapper := setupHealthCheckWrapper()
cc, r := setupClient(t, &clientConfig{testHealthCheckFuncWrapper: testHealthCheckFuncWrapper})
tc := testpb.NewTestServiceClient(cc)
tc := testgrpc.NewTestServiceClient(cc)
sc := parseServiceConfig(t, r, `{
"healthCheckConfig": {
"serviceName": "foo"
@ -503,7 +505,7 @@ func (s) TestHealthCheckWithClientConnClose(t *testing.T) {
hcEnterChan, hcExitChan, testHealthCheckFuncWrapper := setupHealthCheckWrapper()
cc, r := setupClient(t, &clientConfig{testHealthCheckFuncWrapper: testHealthCheckFuncWrapper})
tc := testpb.NewTestServiceClient(cc)
tc := testgrpc.NewTestServiceClient(cc)
r.UpdateState(resolver.State{
Addresses: []resolver.Address{{Addr: lis.Addr().String()}},
ServiceConfig: parseServiceConfig(t, r, `{
@ -676,7 +678,7 @@ func testHealthCheckDisableWithDialOption(t *testing.T, addr string) {
testHealthCheckFuncWrapper: testHealthCheckFuncWrapper,
extraDialOption: []grpc.DialOption{grpc.WithDisableHealthCheck()},
})
tc := testpb.NewTestServiceClient(cc)
tc := testgrpc.NewTestServiceClient(cc)
r.UpdateState(resolver.State{
Addresses: []resolver.Address{{Addr: addr}},
ServiceConfig: parseServiceConfig(t, r, `{
@ -710,7 +712,7 @@ func testHealthCheckDisableWithBalancer(t *testing.T, addr string) {
cc, r := setupClient(t, &clientConfig{
testHealthCheckFuncWrapper: testHealthCheckFuncWrapper,
})
tc := testpb.NewTestServiceClient(cc)
tc := testgrpc.NewTestServiceClient(cc)
r.UpdateState(resolver.State{
Addresses: []resolver.Address{{Addr: addr}},
ServiceConfig: parseServiceConfig(t, r, `{
@ -742,7 +744,7 @@ func testHealthCheckDisableWithBalancer(t *testing.T, addr string) {
func testHealthCheckDisableWithServiceConfig(t *testing.T, addr string) {
hcEnterChan, _, testHealthCheckFuncWrapper := setupHealthCheckWrapper()
cc, r := setupClient(t, &clientConfig{testHealthCheckFuncWrapper: testHealthCheckFuncWrapper})
tc := testpb.NewTestServiceClient(cc)
tc := testgrpc.NewTestServiceClient(cc)
r.UpdateState(resolver.State{Addresses: []resolver.Address{{Addr: addr}}})
ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)

View File

@ -28,7 +28,8 @@ import (
"google.golang.org/grpc/credentials/insecure"
"google.golang.org/grpc/internal/transport"
"google.golang.org/grpc/status"
testpb "google.golang.org/grpc/test/grpc_testing"
testgrpc "google.golang.org/grpc/interop/grpc_testing"
)
func (s) TestHTTPHeaderFrameErrorHandlingHTTPMode(t *testing.T) {
@ -248,7 +249,7 @@ func doHTTPHeaderTest(lisAddr string, errCode codes.Code) error {
defer cc.Close()
ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
defer cancel()
client := testpb.NewTestServiceClient(cc)
client := testgrpc.NewTestServiceClient(cc)
stream, err := client.FullDuplexCall(ctx)
if err != nil {
return fmt.Errorf("creating FullDuplex stream: %v", err)

View File

@ -32,7 +32,8 @@ import (
"google.golang.org/grpc/peer"
"google.golang.org/grpc/status"
testpb "google.golang.org/grpc/test/grpc_testing"
testgrpc "google.golang.org/grpc/interop/grpc_testing"
testpb "google.golang.org/grpc/interop/grpc_testing"
)
// testLegacyPerRPCCredentials is a PerRPCCredentials that has yet incorporated security level.
@ -111,7 +112,7 @@ func (s) TestInsecureCreds(t *testing.T) {
s := grpc.NewServer(sOpts...)
defer s.Stop()
testpb.RegisterTestServiceServer(s, ss)
testgrpc.RegisterTestServiceServer(s, ss)
lis, err := net.Listen("tcp", "localhost:0")
if err != nil {
@ -131,7 +132,7 @@ func (s) TestInsecureCreds(t *testing.T) {
}
defer cc.Close()
c := testpb.NewTestServiceClient(cc)
c := testgrpc.NewTestServiceClient(cc)
ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
defer cancel()
if _, err = c.EmptyCall(ctx, &testpb.Empty{}); err != nil {
@ -150,7 +151,7 @@ func (s) TestInsecureCreds_WithPerRPCCredentials_AsCallOption(t *testing.T) {
s := grpc.NewServer(grpc.Creds(insecure.NewCredentials()))
defer s.Stop()
testpb.RegisterTestServiceServer(s, ss)
testgrpc.RegisterTestServiceServer(s, ss)
lis, err := net.Listen("tcp", "localhost:0")
if err != nil {
@ -171,7 +172,7 @@ func (s) TestInsecureCreds_WithPerRPCCredentials_AsCallOption(t *testing.T) {
defer cc.Close()
const wantErr = "transport: cannot send secure credentials on an insecure connection"
c := testpb.NewTestServiceClient(cc)
c := testgrpc.NewTestServiceClient(cc)
if _, err = c.EmptyCall(ctx, &testpb.Empty{}, copts...); err == nil || !strings.Contains(err.Error(), wantErr) {
t.Fatalf("insecure credentials with per-RPC credentials requiring transport security returned error: %v; want %s", err, wantErr)
}
@ -186,7 +187,7 @@ func (s) TestInsecureCreds_WithPerRPCCredentials_AsDialOption(t *testing.T) {
s := grpc.NewServer(grpc.Creds(insecure.NewCredentials()))
defer s.Stop()
testpb.RegisterTestServiceServer(s, ss)
testgrpc.RegisterTestServiceServer(s, ss)
lis, err := net.Listen("tcp", "localhost:0")
if err != nil {

View File

@ -27,7 +27,9 @@ import (
"google.golang.org/grpc"
"google.golang.org/grpc/internal/stubserver"
"google.golang.org/grpc/internal/testutils"
testpb "google.golang.org/grpc/test/grpc_testing"
testgrpc "google.golang.org/grpc/interop/grpc_testing"
testpb "google.golang.org/grpc/interop/grpc_testing"
)
type parentCtxkey struct{}
@ -252,7 +254,7 @@ func (s) TestChainStreamClientInterceptor_ContextValuePropagation(t *testing.T)
// Start a stub server and use the above chain of interceptors while creating
// a ClientConn to it.
ss := &stubserver.StubServer{
FullDuplexCallF: func(stream testpb.TestService_FullDuplexCallServer) error {
FullDuplexCallF: func(stream testgrpc.TestService_FullDuplexCallServer) error {
if _, err := stream.Recv(); err != nil {
return err
}

View File

@ -27,8 +27,8 @@ import (
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/internal/stubserver"
testpb "google.golang.org/grpc/interop/grpc_testing"
"google.golang.org/grpc/status"
testpb "google.golang.org/grpc/test/grpc_testing"
)
// TestInvoke verifies a straightforward invocation of ClientConn.Invoke().

View File

@ -35,7 +35,8 @@ import (
"google.golang.org/grpc/peer"
"google.golang.org/grpc/status"
testpb "google.golang.org/grpc/test/grpc_testing"
testgrpc "google.golang.org/grpc/interop/grpc_testing"
testpb "google.golang.org/grpc/interop/grpc_testing"
)
func testLocalCredsE2ESucceed(network, address string) error {
@ -73,7 +74,7 @@ func testLocalCredsE2ESucceed(network, address string) error {
s := grpc.NewServer(sopts...)
defer s.Stop()
testpb.RegisterTestServiceServer(s, ss)
testgrpc.RegisterTestServiceServer(s, ss)
lis, err := net.Listen(network, address)
if err != nil {
@ -101,7 +102,7 @@ func testLocalCredsE2ESucceed(network, address string) error {
}
defer cc.Close()
c := testpb.NewTestServiceClient(cc)
c := testgrpc.NewTestServiceClient(cc)
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
defer cancel()
@ -171,7 +172,7 @@ func testLocalCredsE2EFail(dopts []grpc.DialOption) error {
s := grpc.NewServer(sopts...)
defer s.Stop()
testpb.RegisterTestServiceServer(s, ss)
testgrpc.RegisterTestServiceServer(s, ss)
lis, err := net.Listen("tcp", "localhost:0")
if err != nil {
@ -196,7 +197,7 @@ func testLocalCredsE2EFail(dopts []grpc.DialOption) error {
}
defer cc.Close()
c := testpb.NewTestServiceClient(cc)
c := testgrpc.NewTestServiceClient(cc)
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
defer cancel()

View File

@ -32,7 +32,9 @@ import (
"google.golang.org/grpc/internal/stubserver"
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/status"
testpb "google.golang.org/grpc/test/grpc_testing"
testgrpc "google.golang.org/grpc/interop/grpc_testing"
testpb "google.golang.org/grpc/interop/grpc_testing"
)
func (s) TestInvalidMetadata(t *testing.T) {
@ -96,7 +98,7 @@ func (s) TestInvalidMetadata(t *testing.T) {
EmptyCallF: func(ctx context.Context, in *testpb.Empty) (*testpb.Empty, error) {
return &testpb.Empty{}, nil
},
FullDuplexCallF: func(stream testpb.TestService_FullDuplexCallServer) error {
FullDuplexCallF: func(stream testgrpc.TestService_FullDuplexCallServer) error {
_, err := stream.Recv()
if err != nil {
return err

View File

@ -34,8 +34,8 @@ import (
"google.golang.org/grpc/resolver/manual"
"google.golang.org/grpc/status"
testgrpc "google.golang.org/grpc/test/grpc_testing"
testpb "google.golang.org/grpc/test/grpc_testing"
testgrpc "google.golang.org/grpc/interop/grpc_testing"
testpb "google.golang.org/grpc/interop/grpc_testing"
)
const pickFirstServiceConfig = `{"loadBalancingConfig": [{"pick_first":{}}]}`
@ -257,7 +257,7 @@ func (s) TestPickFirst_NewAddressWhileBlocking(t *testing.T) {
}
doneCh := make(chan struct{})
client := testpb.NewTestServiceClient(cc)
client := testgrpc.NewTestServiceClient(cc)
go func() {
// The channel is currently in TransientFailure and this RPC will block
// until the channel becomes Ready, which will only happen when we push a

View File

@ -39,7 +39,9 @@ import (
"google.golang.org/grpc/resolver/manual"
"google.golang.org/grpc/serviceconfig"
"google.golang.org/grpc/status"
testpb "google.golang.org/grpc/test/grpc_testing"
testgrpc "google.golang.org/grpc/interop/grpc_testing"
testpb "google.golang.org/grpc/interop/grpc_testing"
)
// TestResolverUpdateDuringBuild_ServiceConfigParseError makes the
@ -62,7 +64,7 @@ func (s) TestResolverUpdateDuringBuild_ServiceConfigParseError(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
defer cancel()
client := testpb.NewTestServiceClient(cc)
client := testgrpc.NewTestServiceClient(cc)
const wantMsg = "error parsing service config"
const wantCode = codes.Unavailable
if _, err := client.EmptyCall(ctx, &testpb.Empty{}); status.Code(err) != wantCode || !strings.Contains(status.Convert(err).Message(), wantMsg) {
@ -94,7 +96,7 @@ func (s) TestResolverUpdateDuringBuild_ServiceConfigInvalidTypeError(t *testing.
ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
defer cancel()
client := testpb.NewTestServiceClient(cc)
client := testgrpc.NewTestServiceClient(cc)
const wantMsg = "illegal service config type"
const wantCode = codes.Unavailable
if _, err := client.EmptyCall(ctx, &testpb.Empty{}); status.Code(err) != wantCode || !strings.Contains(status.Convert(err).Message(), wantMsg) {
@ -120,7 +122,7 @@ func (s) TestResolverUpdate_InvalidServiceConfigAsFirstUpdate(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
defer cancel()
client := testpb.NewTestServiceClient(cc)
client := testgrpc.NewTestServiceClient(cc)
const wantMsg = "error parsing service config"
const wantCode = codes.Unavailable
if _, err := client.EmptyCall(ctx, &testpb.Empty{}); status.Code(err) != wantCode || !strings.Contains(status.Convert(err).Message(), wantMsg) {
@ -232,7 +234,7 @@ func (s) TestResolverUpdate_InvalidServiceConfigAfterGoodUpdate(t *testing.T) {
}
// Ensure RPCs are successful.
client := testpb.NewTestServiceClient(cc)
client := testgrpc.NewTestServiceClient(cc)
if _, err := client.EmptyCall(ctx, &testpb.Empty{}); err != nil {
t.Fatalf("EmptyCall RPC failed: %v", err)
}

View File

@ -39,7 +39,9 @@ import (
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/stats"
"google.golang.org/grpc/status"
testpb "google.golang.org/grpc/test/grpc_testing"
testgrpc "google.golang.org/grpc/interop/grpc_testing"
testpb "google.golang.org/grpc/interop/grpc_testing"
)
func (s) TestRetryUnary(t *testing.T) {
@ -174,12 +176,12 @@ func (s) TestRetryStreaming(t *testing.T) {
largePayload, _ := newPayload(testpb.PayloadType_COMPRESSABLE, 500)
type serverOp func(stream testpb.TestService_FullDuplexCallServer) error
type clientOp func(stream testpb.TestService_FullDuplexCallClient) error
type serverOp func(stream testgrpc.TestService_FullDuplexCallServer) error
type clientOp func(stream testgrpc.TestService_FullDuplexCallClient) error
// Server Operations
sAttempts := func(n int) serverOp {
return func(stream testpb.TestService_FullDuplexCallServer) error {
return func(stream testgrpc.TestService_FullDuplexCallServer) error {
const key = "grpc-previous-rpc-attempts"
md, ok := metadata.FromIncomingContext(stream.Context())
if !ok {
@ -192,7 +194,7 @@ func (s) TestRetryStreaming(t *testing.T) {
}
}
sReq := func(b byte) serverOp {
return func(stream testpb.TestService_FullDuplexCallServer) error {
return func(stream testgrpc.TestService_FullDuplexCallServer) error {
want := req(b)
if got, err := stream.Recv(); err != nil || !proto.Equal(got, want) {
return status.Errorf(codes.Internal, "server: Recv() = %v, %v; want %v, <nil>", got, err, want)
@ -201,7 +203,7 @@ func (s) TestRetryStreaming(t *testing.T) {
}
}
sReqPayload := func(p *testpb.Payload) serverOp {
return func(stream testpb.TestService_FullDuplexCallServer) error {
return func(stream testgrpc.TestService_FullDuplexCallServer) error {
want := &testpb.StreamingOutputCallRequest{Payload: p}
if got, err := stream.Recv(); err != nil || !proto.Equal(got, want) {
return status.Errorf(codes.Internal, "server: Recv() = %v, %v; want %v, <nil>", got, err, want)
@ -210,7 +212,7 @@ func (s) TestRetryStreaming(t *testing.T) {
}
}
sRes := func(b byte) serverOp {
return func(stream testpb.TestService_FullDuplexCallServer) error {
return func(stream testgrpc.TestService_FullDuplexCallServer) error {
msg := res(b)
if err := stream.Send(msg); err != nil {
return status.Errorf(codes.Internal, "server: Send(%v) = %v; want <nil>", msg, err)
@ -219,12 +221,12 @@ func (s) TestRetryStreaming(t *testing.T) {
}
}
sErr := func(c codes.Code) serverOp {
return func(stream testpb.TestService_FullDuplexCallServer) error {
return func(stream testgrpc.TestService_FullDuplexCallServer) error {
return status.New(c, "").Err()
}
}
sCloseSend := func() serverOp {
return func(stream testpb.TestService_FullDuplexCallServer) error {
return func(stream testgrpc.TestService_FullDuplexCallServer) error {
if msg, err := stream.Recv(); msg != nil || err != io.EOF {
return status.Errorf(codes.Internal, "server: Recv() = %v, %v; want <nil>, io.EOF", msg, err)
}
@ -232,7 +234,7 @@ func (s) TestRetryStreaming(t *testing.T) {
}
}
sPushback := func(s string) serverOp {
return func(stream testpb.TestService_FullDuplexCallServer) error {
return func(stream testgrpc.TestService_FullDuplexCallServer) error {
stream.SetTrailer(metadata.MD{"grpc-retry-pushback-ms": []string{s}})
return nil
}
@ -240,7 +242,7 @@ func (s) TestRetryStreaming(t *testing.T) {
// Client Operations
cReq := func(b byte) clientOp {
return func(stream testpb.TestService_FullDuplexCallClient) error {
return func(stream testgrpc.TestService_FullDuplexCallClient) error {
msg := req(b)
if err := stream.Send(msg); err != nil {
return fmt.Errorf("client: Send(%v) = %v; want <nil>", msg, err)
@ -249,7 +251,7 @@ func (s) TestRetryStreaming(t *testing.T) {
}
}
cReqPayload := func(p *testpb.Payload) clientOp {
return func(stream testpb.TestService_FullDuplexCallClient) error {
return func(stream testgrpc.TestService_FullDuplexCallClient) error {
msg := &testpb.StreamingOutputCallRequest{Payload: p}
if err := stream.Send(msg); err != nil {
return fmt.Errorf("client: Send(%v) = %v; want <nil>", msg, err)
@ -258,7 +260,7 @@ func (s) TestRetryStreaming(t *testing.T) {
}
}
cRes := func(b byte) clientOp {
return func(stream testpb.TestService_FullDuplexCallClient) error {
return func(stream testgrpc.TestService_FullDuplexCallClient) error {
want := res(b)
if got, err := stream.Recv(); err != nil || !proto.Equal(got, want) {
return fmt.Errorf("client: Recv() = %v, %v; want %v, <nil>", got, err, want)
@ -267,7 +269,7 @@ func (s) TestRetryStreaming(t *testing.T) {
}
}
cErr := func(c codes.Code) clientOp {
return func(stream testpb.TestService_FullDuplexCallClient) error {
return func(stream testgrpc.TestService_FullDuplexCallClient) error {
want := status.New(c, "").Err()
if c == codes.OK {
want = io.EOF
@ -282,7 +284,7 @@ func (s) TestRetryStreaming(t *testing.T) {
}
}
cCloseSend := func() clientOp {
return func(stream testpb.TestService_FullDuplexCallClient) error {
return func(stream testgrpc.TestService_FullDuplexCallClient) error {
if err := stream.CloseSend(); err != nil {
return fmt.Errorf("client: CloseSend() = %v; want <nil>", err)
}
@ -291,13 +293,13 @@ func (s) TestRetryStreaming(t *testing.T) {
}
var curTime time.Time
cGetTime := func() clientOp {
return func(_ testpb.TestService_FullDuplexCallClient) error {
return func(_ testgrpc.TestService_FullDuplexCallClient) error {
curTime = time.Now()
return nil
}
}
cCheckElapsed := func(d time.Duration) clientOp {
return func(_ testpb.TestService_FullDuplexCallClient) error {
return func(_ testgrpc.TestService_FullDuplexCallClient) error {
if elapsed := time.Since(curTime); elapsed < d {
return fmt.Errorf("elapsed time: %v; want >= %v", elapsed, d)
}
@ -305,13 +307,13 @@ func (s) TestRetryStreaming(t *testing.T) {
}
}
cHdr := func() clientOp {
return func(stream testpb.TestService_FullDuplexCallClient) error {
return func(stream testgrpc.TestService_FullDuplexCallClient) error {
_, err := stream.Header()
return err
}
}
cCtx := func() clientOp {
return func(stream testpb.TestService_FullDuplexCallClient) error {
return func(stream testgrpc.TestService_FullDuplexCallClient) error {
stream.Context()
return nil
}
@ -400,7 +402,7 @@ func (s) TestRetryStreaming(t *testing.T) {
var serverOpIter int
var serverOps []serverOp
ss := &stubserver.StubServer{
FullDuplexCallF: func(stream testpb.TestService_FullDuplexCallServer) error {
FullDuplexCallF: func(stream testgrpc.TestService_FullDuplexCallServer) error {
for serverOpIter < len(serverOps) {
op := serverOps[serverOpIter]
serverOpIter++
@ -533,7 +535,7 @@ func (s) TestRetryStats(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
defer cancel()
client := testpb.NewTestServiceClient(cc)
client := testgrpc.NewTestServiceClient(cc)
if _, err := client.EmptyCall(ctx, &testpb.Empty{}); err != nil {
t.Fatalf("unexpected EmptyCall error: %v", err)
@ -641,7 +643,7 @@ func (s) TestRetryTransparentWhenCommitted(t *testing.T) {
first := grpcsync.NewEvent()
ss := &stubserver.StubServer{
FullDuplexCallF: func(stream testpb.TestService_FullDuplexCallServer) error {
FullDuplexCallF: func(stream testgrpc.TestService_FullDuplexCallServer) error {
// signal?
if !first.HasFired() {
first.Fire()

View File

@ -37,7 +37,8 @@ import (
"google.golang.org/grpc/resolver/manual"
"google.golang.org/grpc/status"
testpb "google.golang.org/grpc/test/grpc_testing"
testgrpc "google.golang.org/grpc/interop/grpc_testing"
testpb "google.golang.org/grpc/interop/grpc_testing"
)
const rrServiceConfig = `{"loadBalancingConfig": [{"round_robin":{}}]}`
@ -79,7 +80,7 @@ func testRoundRobinBasic(ctx context.Context, t *testing.T, opts ...grpc.DialOpt
t.Fatalf("grpc.Dial() failed: %v", err)
}
t.Cleanup(func() { cc.Close() })
client := testpb.NewTestServiceClient(cc)
client := testgrpc.NewTestServiceClient(cc)
// At this point, the resolver has not returned any addresses to the channel.
// This RPC must block until the context expires.
@ -125,7 +126,7 @@ func (s) TestRoundRobin_AddressesRemoved(t *testing.T) {
}
const msgWant = "produced zero addresses"
client := testpb.NewTestServiceClient(cc)
client := testgrpc.NewTestServiceClient(cc)
if _, err := client.EmptyCall(ctx, &testpb.Empty{}); !strings.Contains(status.Convert(err).Message(), msgWant) {
t.Fatalf("EmptyCall() = %v, want Contains(Message(), %q)", err, msgWant)
}
@ -150,7 +151,7 @@ func (s) TestRoundRobin_NewAddressWhileBlocking(t *testing.T) {
}
}
client := testpb.NewTestServiceClient(cc)
client := testgrpc.NewTestServiceClient(cc)
doneCh := make(chan struct{})
go func() {
// The channel is currently in TransientFailure and this RPC will block
@ -208,7 +209,7 @@ func (s) TestRoundRobin_OneServerDown(t *testing.T) {
for i := 0; i < len(backends)-1; i++ {
addrs[i] = resolver.Address{Addr: backends[i].Address}
}
client := testpb.NewTestServiceClient(cc)
client := testgrpc.NewTestServiceClient(cc)
if err := rrutil.CheckRoundRobinRPCs(ctx, client, addrs); err != nil {
t.Fatalf("RPCs are not being round robined across remaining servers: %v", err)
}
@ -236,7 +237,7 @@ func (s) TestRoundRobin_AllServersDown(t *testing.T) {
}
// Failfast RPCs should fail with Unavailable.
client := testpb.NewTestServiceClient(cc)
client := testgrpc.NewTestServiceClient(cc)
if _, err := client.EmptyCall(context.Background(), &testpb.Empty{}); status.Code(err) == codes.Unavailable {
return
}
@ -291,7 +292,7 @@ func (s) TestRoundRobin_UpdateAddressAttributes(t *testing.T) {
r.UpdateState(resolver.State{Addresses: []resolver.Address{addr}})
// Make an RPC and ensure it does not contain the metadata we are looking for.
client := testpb.NewTestServiceClient(cc)
client := testgrpc.NewTestServiceClient(cc)
ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
defer cancel()
if _, err := client.EmptyCall(ctx, &testpb.Empty{}); err != nil {

View File

@ -27,7 +27,9 @@ import (
"google.golang.org/grpc/codes"
"google.golang.org/grpc/internal/stubserver"
"google.golang.org/grpc/status"
testpb "google.golang.org/grpc/test/grpc_testing"
testgrpc "google.golang.org/grpc/interop/grpc_testing"
testpb "google.golang.org/grpc/interop/grpc_testing"
)
type ctxKey string
@ -40,7 +42,7 @@ func (s) TestServerReturningContextError(t *testing.T) {
EmptyCallF: func(ctx context.Context, in *testpb.Empty) (*testpb.Empty, error) {
return nil, context.DeadlineExceeded
},
FullDuplexCallF: func(stream testpb.TestService_FullDuplexCallServer) error {
FullDuplexCallF: func(stream testgrpc.TestService_FullDuplexCallServer) error {
return context.DeadlineExceeded
},
}
@ -286,7 +288,7 @@ func (s) TestChainStreamServerInterceptor(t *testing.T) {
}
ss := &stubserver.StubServer{
FullDuplexCallF: func(stream testpb.TestService_FullDuplexCallServer) error {
FullDuplexCallF: func(stream testgrpc.TestService_FullDuplexCallServer) error {
if callCounts[0] != 1 {
return status.Errorf(codes.Internal, "callCounts[0] should be 1, but got=%d", callCounts[0])
}

View File

@ -28,7 +28,9 @@ import (
"google.golang.org/grpc/codes"
"google.golang.org/grpc/internal/stubserver"
"google.golang.org/grpc/status"
testpb "google.golang.org/grpc/test/grpc_testing"
testgrpc "google.golang.org/grpc/interop/grpc_testing"
testpb "google.golang.org/grpc/interop/grpc_testing"
)
func (s) TestStreamCleanup(t *testing.T) {
@ -68,7 +70,7 @@ func (s) TestStreamCleanupAfterSendStatus(t *testing.T) {
serverReturnedStatus := make(chan struct{})
ss := &stubserver.StubServer{
FullDuplexCallF: func(stream testpb.TestService_FullDuplexCallServer) error {
FullDuplexCallF: func(stream testgrpc.TestService_FullDuplexCallServer) error {
defer func() {
close(serverReturnedStatus)
}()

View File

@ -31,7 +31,9 @@ import (
"google.golang.org/grpc/internal/stubserver"
"google.golang.org/grpc/internal/transport"
"google.golang.org/grpc/status"
testpb "google.golang.org/grpc/test/grpc_testing"
testgrpc "google.golang.org/grpc/interop/grpc_testing"
testpb "google.golang.org/grpc/interop/grpc_testing"
)
// connWrapperWithCloseCh wraps a net.Conn and fires an event when closed.
@ -85,7 +87,7 @@ func (s) TestClientTransportRestartsAfterStreamIDExhausted(t *testing.T) {
}()
ss := &stubserver.StubServer{
FullDuplexCallF: func(stream testpb.TestService_FullDuplexCallServer) error {
FullDuplexCallF: func(stream testgrpc.TestService_FullDuplexCallServer) error {
if _, err := stream.Recv(); err != nil {
return status.Errorf(codes.Internal, "unexpected error receiving: %v", err)
}
@ -108,7 +110,7 @@ func (s) TestClientTransportRestartsAfterStreamIDExhausted(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
defer cancel()
var streams []testpb.TestService_FullDuplexCallClient
var streams []testgrpc.TestService_FullDuplexCallClient
const numStreams = 3
// expected number of conns when each stream is created i.e., 3rd stream is created

View File

@ -32,8 +32,8 @@ import (
v3corepb "github.com/envoyproxy/go-control-plane/envoy/config/core/v3"
v3discoverypb "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v3"
testgrpc "google.golang.org/grpc/test/grpc_testing"
testpb "google.golang.org/grpc/test/grpc_testing"
testgrpc "google.golang.org/grpc/interop/grpc_testing"
testpb "google.golang.org/grpc/interop/grpc_testing"
)
// We are interested in LDS, RDS, CDS and EDS resources as part of the regular

View File

@ -31,8 +31,8 @@ import (
v3clusterpb "github.com/envoyproxy/go-control-plane/envoy/config/cluster/v3"
v3corepb "github.com/envoyproxy/go-control-plane/envoy/config/core/v3"
v3routepb "github.com/envoyproxy/go-control-plane/envoy/config/route/v3"
testgrpc "google.golang.org/grpc/test/grpc_testing"
testpb "google.golang.org/grpc/test/grpc_testing"
testgrpc "google.golang.org/grpc/interop/grpc_testing"
testpb "google.golang.org/grpc/interop/grpc_testing"
)
// hashRouteConfig returns a RouteConfig resource with hash policy set to

View File

@ -39,8 +39,8 @@ import (
v3endpointpb "github.com/envoyproxy/go-control-plane/envoy/config/endpoint/v3"
v3listenerpb "github.com/envoyproxy/go-control-plane/envoy/config/listener/v3"
v3routepb "github.com/envoyproxy/go-control-plane/envoy/config/route/v3"
testgrpc "google.golang.org/grpc/test/grpc_testing"
testpb "google.golang.org/grpc/test/grpc_testing"
testgrpc "google.golang.org/grpc/interop/grpc_testing"
testpb "google.golang.org/grpc/interop/grpc_testing"
)
// TestClientSideFederation tests that federation is supported.
@ -187,7 +187,7 @@ func (s) TestFederation_UnknownAuthorityInDialTarget(t *testing.T) {
defer cc.Close()
t.Log("Created ClientConn to test service")
client := testpb.NewTestServiceClient(cc)
client := testgrpc.NewTestServiceClient(cc)
if _, err := client.EmptyCall(ctx, &testpb.Empty{}); err != nil {
t.Fatalf("EmptyCall() RPC: %v", err)
}
@ -260,7 +260,7 @@ func (s) TestFederation_UnknownAuthorityInReceivedResponse(t *testing.T) {
defer cc.Close()
t.Log("Created ClientConn to test service")
client := testpb.NewTestServiceClient(cc)
client := testgrpc.NewTestServiceClient(cc)
_, err = client.EmptyCall(ctx, &testpb.Empty{})
if err == nil {
t.Fatal("EmptyCall RPC succeeded for target with unknown authority when expected to fail")

View File

@ -41,8 +41,8 @@ import (
endpointpb "github.com/envoyproxy/go-control-plane/envoy/config/endpoint/v3"
listenerpb "github.com/envoyproxy/go-control-plane/envoy/config/listener/v3"
routepb "github.com/envoyproxy/go-control-plane/envoy/config/route/v3"
testgrpc "google.golang.org/grpc/test/grpc_testing"
testpb "google.golang.org/grpc/test/grpc_testing"
testgrpc "google.golang.org/grpc/interop/grpc_testing"
testpb "google.golang.org/grpc/interop/grpc_testing"
)
const (

View File

@ -32,8 +32,8 @@ import (
"google.golang.org/grpc/internal/stubserver"
"google.golang.org/grpc/internal/testutils/xds/e2e"
testgrpc "google.golang.org/grpc/test/grpc_testing"
testpb "google.golang.org/grpc/test/grpc_testing"
testgrpc "google.golang.org/grpc/interop/grpc_testing"
testpb "google.golang.org/grpc/interop/grpc_testing"
)
type s struct {

View File

@ -34,10 +34,10 @@ import (
"google.golang.org/grpc/credentials/insecure"
"google.golang.org/grpc/internal/stubserver"
"google.golang.org/grpc/internal/testutils/xds/e2e"
testgrpc "google.golang.org/grpc/interop/grpc_testing"
testpb "google.golang.org/grpc/interop/grpc_testing"
"google.golang.org/grpc/peer"
"google.golang.org/grpc/resolver"
testgrpc "google.golang.org/grpc/test/grpc_testing"
testpb "google.golang.org/grpc/test/grpc_testing"
"google.golang.org/protobuf/types/known/durationpb"
"google.golang.org/protobuf/types/known/wrapperspb"
)
@ -121,7 +121,7 @@ func clusterWithOutlierDetection(clusterName, edsServiceName string, secLevel e2
//
// Returns a non-nil error if context deadline expires before RPCs start to get
// roundrobined across the given backends.
func checkRoundRobinRPCs(ctx context.Context, client testpb.TestServiceClient, addrs []resolver.Address) error {
func checkRoundRobinRPCs(ctx context.Context, client testgrpc.TestServiceClient, addrs []resolver.Address) error {
wantAddrCount := make(map[string]int)
for _, addr := range addrs {
wantAddrCount[addr.Addr]++

View File

@ -32,8 +32,8 @@ import (
"google.golang.org/protobuf/types/known/wrapperspb"
v3routepb "github.com/envoyproxy/go-control-plane/envoy/config/route/v3"
testgrpc "google.golang.org/grpc/test/grpc_testing"
testpb "google.golang.org/grpc/test/grpc_testing"
testgrpc "google.golang.org/grpc/interop/grpc_testing"
testpb "google.golang.org/grpc/interop/grpc_testing"
)
func (s) TestClientSideRetry(t *testing.T) {

View File

@ -37,8 +37,8 @@ import (
v3listenerpb "github.com/envoyproxy/go-control-plane/envoy/config/listener/v3"
v3routepb "github.com/envoyproxy/go-control-plane/envoy/config/route/v3"
rlspb "google.golang.org/grpc/internal/proto/grpc_lookup_v1"
testgrpc "google.golang.org/grpc/test/grpc_testing"
testpb "google.golang.org/grpc/test/grpc_testing"
testgrpc "google.golang.org/grpc/interop/grpc_testing"
testpb "google.golang.org/grpc/interop/grpc_testing"
_ "google.golang.org/grpc/balancer/rls" // Register the RLS Load Balancing policy.
)

View File

@ -31,8 +31,8 @@ import (
v3corepb "github.com/envoyproxy/go-control-plane/envoy/config/core/v3"
v3tlspb "github.com/envoyproxy/go-control-plane/envoy/extensions/transport_sockets/tls/v3"
testgrpc "google.golang.org/grpc/test/grpc_testing"
testpb "google.golang.org/grpc/test/grpc_testing"
testgrpc "google.golang.org/grpc/interop/grpc_testing"
testpb "google.golang.org/grpc/interop/grpc_testing"
)
func (s) TestUnmarshalListener_WithUpdateValidatorFunc(t *testing.T) {

View File

@ -34,12 +34,12 @@ import (
"google.golang.org/grpc/status"
"google.golang.org/grpc/xds"
testgrpc "google.golang.org/grpc/test/grpc_testing"
testpb "google.golang.org/grpc/test/grpc_testing"
testgrpc "google.golang.org/grpc/interop/grpc_testing"
testpb "google.golang.org/grpc/interop/grpc_testing"
)
type testService struct {
testpb.TestServiceServer
testgrpc.TestServiceServer
}
func (*testService) EmptyCall(context.Context, *testpb.Empty) (*testpb.Empty, error) {

View File

@ -45,8 +45,8 @@ import (
v3httppb "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/network/http_connection_manager/v3"
v3matcherpb "github.com/envoyproxy/go-control-plane/envoy/type/matcher/v3"
wrapperspb "github.com/golang/protobuf/ptypes/wrappers"
testgrpc "google.golang.org/grpc/test/grpc_testing"
testpb "google.golang.org/grpc/test/grpc_testing"
testgrpc "google.golang.org/grpc/interop/grpc_testing"
testpb "google.golang.org/grpc/interop/grpc_testing"
)
// TestServerSideXDS_RouteConfiguration is an e2e test which verifies routing
@ -830,7 +830,7 @@ func (s) TestRBACToggledOn_WithBadRouteConfiguration(t *testing.T) {
}
defer cc.Close()
client := testpb.NewTestServiceClient(cc)
client := testgrpc.NewTestServiceClient(cc)
if _, err := client.EmptyCall(ctx, &testpb.Empty{}); status.Code(err) != codes.Unavailable {
t.Fatalf("EmptyCall() returned err with status: %v, if RBAC is disabled all RPC's should proceed as normal", status.Code(err))
}
@ -887,7 +887,7 @@ func (s) TestRBACToggledOff_WithBadRouteConfiguration(t *testing.T) {
}
defer cc.Close()
client := testpb.NewTestServiceClient(cc)
client := testgrpc.NewTestServiceClient(cc)
if _, err := client.EmptyCall(ctx, &testpb.Empty{}); status.Code(err) != codes.OK {
t.Fatalf("EmptyCall() returned err with status: %v, if RBAC is disabled all RPC's should proceed as normal", status.Code(err))
}

View File

@ -34,8 +34,8 @@ import (
"google.golang.org/grpc/xds"
v3listenerpb "github.com/envoyproxy/go-control-plane/envoy/config/listener/v3"
testgrpc "google.golang.org/grpc/test/grpc_testing"
testpb "google.golang.org/grpc/test/grpc_testing"
testgrpc "google.golang.org/grpc/interop/grpc_testing"
testpb "google.golang.org/grpc/interop/grpc_testing"
)
// TestServerSideXDS_RedundantUpdateSuppression tests the scenario where the
@ -207,7 +207,7 @@ func (s) TestServerSideXDS_ServingModeChanges(t *testing.T) {
// Initialize an xDS-enabled gRPC server and register the stubServer on it.
server := xds.NewGRPCServer(grpc.Creds(creds), modeChangeOpt, xds.BootstrapContentsForTesting(bootstrapContents))
defer server.Stop()
testpb.RegisterTestServiceServer(server, &testService{})
testgrpc.RegisterTestServiceServer(server, &testService{})
// Setup the management server to respond with server-side Listener
// resources for both listeners.

View File

@ -37,8 +37,8 @@ import (
v3corepb "github.com/envoyproxy/go-control-plane/envoy/config/core/v3"
v3endpointpb "github.com/envoyproxy/go-control-plane/envoy/config/endpoint/v3"
testgrpc "google.golang.org/grpc/test/grpc_testing"
testpb "google.golang.org/grpc/test/grpc_testing"
testgrpc "google.golang.org/grpc/interop/grpc_testing"
testpb "google.golang.org/grpc/interop/grpc_testing"
_ "google.golang.org/grpc/xds"
)

View File

@ -44,8 +44,8 @@ import (
v3corepb "github.com/envoyproxy/go-control-plane/envoy/config/core/v3"
v3endpointpb "github.com/envoyproxy/go-control-plane/envoy/config/endpoint/v3"
v3discoverypb "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v3"
testgrpc "google.golang.org/grpc/test/grpc_testing"
testpb "google.golang.org/grpc/test/grpc_testing"
testgrpc "google.golang.org/grpc/interop/grpc_testing"
testpb "google.golang.org/grpc/interop/grpc_testing"
_ "google.golang.org/grpc/xds/internal/balancer/cdsbalancer" // Register the "cds_experimental" LB policy.
)

View File

@ -45,8 +45,8 @@ import (
v3corepb "github.com/envoyproxy/go-control-plane/envoy/config/core/v3"
v3endpointpb "github.com/envoyproxy/go-control-plane/envoy/config/endpoint/v3"
wrapperspb "github.com/golang/protobuf/ptypes/wrappers"
testgrpc "google.golang.org/grpc/test/grpc_testing"
testpb "google.golang.org/grpc/test/grpc_testing"
testgrpc "google.golang.org/grpc/interop/grpc_testing"
testpb "google.golang.org/grpc/interop/grpc_testing"
_ "google.golang.org/grpc/xds/internal/balancer/clusterresolver" // Register the "cluster_resolver_experimental" LB policy.
)
@ -225,7 +225,7 @@ func (s) TestEDS_OneLocality(t *testing.T) {
defer cc.Close()
// Ensure RPCs are being roundrobined across the single backend.
testClient := testpb.NewTestServiceClient(cc)
testClient := testgrpc.NewTestServiceClient(cc)
if err := rrutil.CheckRoundRobinRPCs(ctx, testClient, addrs[:1]); err != nil {
t.Fatal(err)
}
@ -333,7 +333,7 @@ func (s) TestEDS_MultipleLocalities(t *testing.T) {
defer cc.Close()
// Ensure RPCs are being weighted roundrobined across the two backends.
testClient := testpb.NewTestServiceClient(cc)
testClient := testgrpc.NewTestServiceClient(cc)
if err := rrutil.CheckWeightedRoundRobinRPCs(ctx, testClient, addrs[0:2]); err != nil {
t.Fatal(err)
}
@ -472,7 +472,7 @@ func (s) TestEDS_EndpointsHealth(t *testing.T) {
// Ensure RPCs are being weighted roundrobined across healthy backends from
// both localities.
testClient := testpb.NewTestServiceClient(cc)
testClient := testgrpc.NewTestServiceClient(cc)
if err := rrutil.CheckWeightedRoundRobinRPCs(ctx, testClient, append(addrs[0:2], addrs[6:8]...)); err != nil {
t.Fatal(err)
}
@ -537,7 +537,7 @@ func (s) TestEDS_EmptyUpdate(t *testing.T) {
t.Fatalf("failed to dial local test server: %v", err)
}
defer cc.Close()
testClient := testpb.NewTestServiceClient(cc)
testClient := testgrpc.NewTestServiceClient(cc)
if err := waitForAllPrioritiesRemovedError(ctx, t, testClient); err != nil {
t.Fatal(err)
}

View File

@ -36,7 +36,10 @@ import (
"google.golang.org/grpc/resolver"
"google.golang.org/grpc/resolver/manual"
"google.golang.org/grpc/serviceconfig"
testpb "google.golang.org/grpc/test/grpc_testing"
testgrpc "google.golang.org/grpc/interop/grpc_testing"
testpb "google.golang.org/grpc/interop/grpc_testing"
_ "google.golang.org/grpc/xds/internal/balancer/outlierdetection" // To register helper functions which register/unregister Outlier Detection LB Policy.
)
@ -99,7 +102,7 @@ func setupBackends(t *testing.T) ([]string, func()) {
//
// Returns a non-nil error if context deadline expires before RPCs start to get
// roundrobined across the given backends.
func checkRoundRobinRPCs(ctx context.Context, client testpb.TestServiceClient, addrs []resolver.Address) error {
func checkRoundRobinRPCs(ctx context.Context, client testgrpc.TestServiceClient, addrs []resolver.Address) error {
wantAddrCount := make(map[string]int)
for _, addr := range addrs {
wantAddrCount[addr.Addr]++
@ -224,7 +227,7 @@ func (s) TestOutlierDetectionAlgorithmsE2E(t *testing.T) {
defer cc.Close()
ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
defer cancel()
testServiceClient := testpb.NewTestServiceClient(cc)
testServiceClient := testgrpc.NewTestServiceClient(cc)
// At first, due to no statistics on each of the backends, the 3
// upstreams should all be round robined across.
@ -301,7 +304,7 @@ func (s) TestNoopConfiguration(t *testing.T) {
defer cc.Close()
ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
defer cancel()
testServiceClient := testpb.NewTestServiceClient(cc)
testServiceClient := testgrpc.NewTestServiceClient(cc)
for i := 0; i < 2; i++ {
// Since the Outlier Detection Balancer starts with a noop

View File

@ -31,8 +31,8 @@ import (
"google.golang.org/grpc/resolver"
"google.golang.org/grpc/resolver/manual"
testgrpc "google.golang.org/grpc/test/grpc_testing"
testpb "google.golang.org/grpc/test/grpc_testing"
testgrpc "google.golang.org/grpc/interop/grpc_testing"
testpb "google.golang.org/grpc/interop/grpc_testing"
_ "google.golang.org/grpc/xds/internal/balancer/ringhash" // Register the ring_hash_experimental LB policy.
)
@ -51,7 +51,7 @@ const (
)
type testService struct {
testpb.TestServiceServer
testgrpc.TestServiceServer
}
func (*testService) EmptyCall(context.Context, *testpb.Empty) (*testpb.Empty, error) {

View File

@ -50,7 +50,8 @@ import (
fpb "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/http/fault/v3"
v3httppb "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/network/http_connection_manager/v3"
tpb "github.com/envoyproxy/go-control-plane/envoy/type/v3"
testpb "google.golang.org/grpc/test/grpc_testing"
testgrpc "google.golang.org/grpc/interop/grpc_testing"
testpb "google.golang.org/grpc/interop/grpc_testing"
_ "google.golang.org/grpc/xds/internal/balancer" // Register the balancers.
_ "google.golang.org/grpc/xds/internal/resolver" // Register the xds_resolver.
@ -67,14 +68,14 @@ func Test(t *testing.T) {
}
type testService struct {
testpb.TestServiceServer
testgrpc.TestServiceServer
}
func (*testService) EmptyCall(context.Context, *testpb.Empty) (*testpb.Empty, error) {
return &testpb.Empty{}, nil
}
func (*testService) FullDuplexCall(stream testpb.TestService_FullDuplexCallServer) error {
func (*testService) FullDuplexCall(stream testgrpc.TestService_FullDuplexCallServer) error {
// End RPC after client does a CloseSend.
for {
if _, err := stream.Recv(); err == io.EOF {
@ -116,7 +117,7 @@ func clientSetup(t *testing.T) (*e2e.ManagementServer, string, uint32, func()) {
// Initialize a gRPC server and register the stubServer on it.
server := grpc.NewServer()
testpb.RegisterTestServiceServer(server, &testService{})
testgrpc.RegisterTestServiceServer(server, &testService{})
// Create a local listener and pass it to Serve().
lis, err := testutils.LocalTCPListener()
@ -532,7 +533,7 @@ func (s) TestFaultInjection_Unary(t *testing.T) {
}
defer cc.Close()
client := testpb.NewTestServiceClient(cc)
client := testgrpc.NewTestServiceClient(cc)
count := 0
for _, want := range tc.want {
ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)
@ -607,9 +608,9 @@ func (s) TestFaultInjection_MaxActiveFaults(t *testing.T) {
}
defer cc.Close()
client := testpb.NewTestServiceClient(cc)
client := testgrpc.NewTestServiceClient(cc)
streams := make(chan testpb.TestService_FullDuplexCallClient, 5) // startStream() is called 5 times
streams := make(chan testgrpc.TestService_FullDuplexCallClient, 5) // startStream() is called 5 times
startStream := func() {
str, err := client.FullDuplexCall(ctx)
if err != nil {