Documentation ¶
Overview ¶
Package testutil contains testing helpers (logging, slow skipping).
Package testutil is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Constants
- Variables
- func RegisterTestServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterTestServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client TestServiceClient) error
- func RegisterTestServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterTestServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server TestServiceServer) error
- func RegisterTestServiceServer(s grpc.ServiceRegistrar, srv TestServiceServer)
- func TestingNewServiceClient(ctx context.Context, t *testing.T, opts *Options) (*grpc.ClientConn, *grpc.Server)
- type EchoDuplexTest
- type EchoDuplexTest_Reply
- func (*EchoDuplexTest_Reply) Descriptor() ([]byte, []int)deprecated
- func (x *EchoDuplexTest_Reply) GetEcho() string
- func (*EchoDuplexTest_Reply) ProtoMessage()
- func (x *EchoDuplexTest_Reply) ProtoReflect() protoreflect.Message
- func (x *EchoDuplexTest_Reply) Reset()
- func (x *EchoDuplexTest_Reply) String() string
- type EchoDuplexTest_Request
- func (*EchoDuplexTest_Request) Descriptor() ([]byte, []int)deprecated
- func (x *EchoDuplexTest_Request) GetEcho() string
- func (x *EchoDuplexTest_Request) GetTriggerError() bool
- func (*EchoDuplexTest_Request) ProtoMessage()
- func (x *EchoDuplexTest_Request) ProtoReflect() protoreflect.Message
- func (x *EchoDuplexTest_Request) Reset()
- func (x *EchoDuplexTest_Request) String() string
- type EchoStreamTest
- type EchoStreamTest_Reply
- func (*EchoStreamTest_Reply) Descriptor() ([]byte, []int)deprecated
- func (x *EchoStreamTest_Reply) GetEcho() string
- func (*EchoStreamTest_Reply) ProtoMessage()
- func (x *EchoStreamTest_Reply) ProtoReflect() protoreflect.Message
- func (x *EchoStreamTest_Reply) Reset()
- func (x *EchoStreamTest_Reply) String() string
- type EchoStreamTest_Request
- func (*EchoStreamTest_Request) Descriptor() ([]byte, []int)deprecated
- func (x *EchoStreamTest_Request) GetDelay() int64
- func (x *EchoStreamTest_Request) GetEcho() string
- func (x *EchoStreamTest_Request) GetTriggerError() bool
- func (*EchoStreamTest_Request) ProtoMessage()
- func (x *EchoStreamTest_Request) ProtoReflect() protoreflect.Message
- func (x *EchoStreamTest_Request) Reset()
- func (x *EchoStreamTest_Request) String() string
- type EchoTest
- type EchoTest_Reply
- type EchoTest_Request
- func (*EchoTest_Request) Descriptor() ([]byte, []int)deprecated
- func (x *EchoTest_Request) GetDelay() int64
- func (x *EchoTest_Request) GetEcho() string
- func (x *EchoTest_Request) GetTriggerError() bool
- func (*EchoTest_Request) ProtoMessage()
- func (x *EchoTest_Request) ProtoReflect() protoreflect.Message
- func (x *EchoTest_Request) Reset()
- func (x *EchoTest_Request) String() string
- type Options
- type TestServiceClient
- type TestServiceServer
- type TestService_EchoDuplexTestClient
- type TestService_EchoDuplexTestServer
- type TestService_EchoStreamTestClient
- type TestService_EchoStreamTestServer
- type UnimplementedTestServiceServer
- func (UnimplementedTestServiceServer) EchoDuplexTest(grpc.BidiStreamingServer[EchoDuplexTest_Request, EchoDuplexTest_Reply]) error
- func (UnimplementedTestServiceServer) EchoStreamTest(*EchoStreamTest_Request, grpc.ServerStreamingServer[EchoStreamTest_Reply]) error
- func (UnimplementedTestServiceServer) EchoTest(context.Context, *EchoTest_Request) (*EchoTest_Reply, error)
- type UnsafeTestServiceServer
Constants ¶
const ( TestService_EchoTest_FullMethodName = "/testutil.TestService/EchoTest" TestService_EchoStreamTest_FullMethodName = "/testutil.TestService/EchoStreamTest" TestService_EchoDuplexTest_FullMethodName = "/testutil.TestService/EchoDuplexTest" )
Variables ¶
var File_go_internal_testutil_proto protoreflect.FileDescriptor
var TestService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "testutil.TestService", HandlerType: (*TestServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "EchoTest", Handler: _TestService_EchoTest_Handler, }, }, Streams: []grpc.StreamDesc{ { StreamName: "EchoStreamTest", Handler: _TestService_EchoStreamTest_Handler, ServerStreams: true, }, { StreamName: "EchoDuplexTest", Handler: _TestService_EchoDuplexTest_Handler, ServerStreams: true, ClientStreams: true, }, }, Metadata: "go-internal/testutil.proto", }
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)
Functions ¶
func RegisterTestServiceHandler ¶ added in v2.455.0
func RegisterTestServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
RegisterTestServiceHandler registers the http handlers for service TestService to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterTestServiceHandlerClient ¶ added in v2.455.0
func RegisterTestServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client TestServiceClient) error
RegisterTestServiceHandlerClient registers the http handlers for service TestService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "TestServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "TestServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "TestServiceClient" to call the correct interceptors.
func RegisterTestServiceHandlerFromEndpoint ¶ added in v2.455.0
func RegisterTestServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterTestServiceHandlerFromEndpoint is same as RegisterTestServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterTestServiceHandlerServer ¶ added in v2.455.0
func RegisterTestServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server TestServiceServer) error
RegisterTestServiceHandlerServer registers the http handlers for service TestService to "mux". UnaryRPC :call TestServiceServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterTestServiceHandlerFromEndpoint instead.
func RegisterTestServiceServer ¶ added in v2.246.0
func RegisterTestServiceServer(s grpc.ServiceRegistrar, srv TestServiceServer)
Types ¶
type EchoDuplexTest ¶ added in v2.246.0
type EchoDuplexTest struct {
// contains filtered or unexported fields
}
func (*EchoDuplexTest) Descriptor
deprecated
added in
v2.246.0
func (*EchoDuplexTest) Descriptor() ([]byte, []int)
Deprecated: Use EchoDuplexTest.ProtoReflect.Descriptor instead.
func (*EchoDuplexTest) ProtoMessage ¶ added in v2.246.0
func (*EchoDuplexTest) ProtoMessage()
func (*EchoDuplexTest) ProtoReflect ¶ added in v2.470.4
func (x *EchoDuplexTest) ProtoReflect() protoreflect.Message
func (*EchoDuplexTest) Reset ¶ added in v2.246.0
func (x *EchoDuplexTest) Reset()
func (*EchoDuplexTest) String ¶ added in v2.246.0
func (x *EchoDuplexTest) String() string
type EchoDuplexTest_Reply ¶ added in v2.246.0
type EchoDuplexTest_Reply struct { Echo string `protobuf:"bytes,1,opt,name=echo,proto3" json:"echo,omitempty"` // contains filtered or unexported fields }
func (*EchoDuplexTest_Reply) Descriptor
deprecated
added in
v2.246.0
func (*EchoDuplexTest_Reply) Descriptor() ([]byte, []int)
Deprecated: Use EchoDuplexTest_Reply.ProtoReflect.Descriptor instead.
func (*EchoDuplexTest_Reply) GetEcho ¶ added in v2.246.0
func (x *EchoDuplexTest_Reply) GetEcho() string
func (*EchoDuplexTest_Reply) ProtoMessage ¶ added in v2.246.0
func (*EchoDuplexTest_Reply) ProtoMessage()
func (*EchoDuplexTest_Reply) ProtoReflect ¶ added in v2.470.4
func (x *EchoDuplexTest_Reply) ProtoReflect() protoreflect.Message
func (*EchoDuplexTest_Reply) Reset ¶ added in v2.246.0
func (x *EchoDuplexTest_Reply) Reset()
func (*EchoDuplexTest_Reply) String ¶ added in v2.246.0
func (x *EchoDuplexTest_Reply) String() string
type EchoDuplexTest_Request ¶ added in v2.246.0
type EchoDuplexTest_Request struct { Echo string `protobuf:"bytes,1,opt,name=echo,proto3" json:"echo,omitempty"` TriggerError bool `protobuf:"varint,2,opt,name=trigger_error,json=triggerError,proto3" json:"trigger_error,omitempty"` // contains filtered or unexported fields }
func (*EchoDuplexTest_Request) Descriptor
deprecated
added in
v2.246.0
func (*EchoDuplexTest_Request) Descriptor() ([]byte, []int)
Deprecated: Use EchoDuplexTest_Request.ProtoReflect.Descriptor instead.
func (*EchoDuplexTest_Request) GetEcho ¶ added in v2.246.0
func (x *EchoDuplexTest_Request) GetEcho() string
func (*EchoDuplexTest_Request) GetTriggerError ¶ added in v2.246.0
func (x *EchoDuplexTest_Request) GetTriggerError() bool
func (*EchoDuplexTest_Request) ProtoMessage ¶ added in v2.246.0
func (*EchoDuplexTest_Request) ProtoMessage()
func (*EchoDuplexTest_Request) ProtoReflect ¶ added in v2.470.4
func (x *EchoDuplexTest_Request) ProtoReflect() protoreflect.Message
func (*EchoDuplexTest_Request) Reset ¶ added in v2.246.0
func (x *EchoDuplexTest_Request) Reset()
func (*EchoDuplexTest_Request) String ¶ added in v2.246.0
func (x *EchoDuplexTest_Request) String() string
type EchoStreamTest ¶ added in v2.246.0
type EchoStreamTest struct {
// contains filtered or unexported fields
}
func (*EchoStreamTest) Descriptor
deprecated
added in
v2.246.0
func (*EchoStreamTest) Descriptor() ([]byte, []int)
Deprecated: Use EchoStreamTest.ProtoReflect.Descriptor instead.
func (*EchoStreamTest) ProtoMessage ¶ added in v2.246.0
func (*EchoStreamTest) ProtoMessage()
func (*EchoStreamTest) ProtoReflect ¶ added in v2.470.4
func (x *EchoStreamTest) ProtoReflect() protoreflect.Message
func (*EchoStreamTest) Reset ¶ added in v2.246.0
func (x *EchoStreamTest) Reset()
func (*EchoStreamTest) String ¶ added in v2.246.0
func (x *EchoStreamTest) String() string
type EchoStreamTest_Reply ¶ added in v2.246.0
type EchoStreamTest_Reply struct { Echo string `protobuf:"bytes,1,opt,name=echo,proto3" json:"echo,omitempty"` // contains filtered or unexported fields }
func (*EchoStreamTest_Reply) Descriptor
deprecated
added in
v2.246.0
func (*EchoStreamTest_Reply) Descriptor() ([]byte, []int)
Deprecated: Use EchoStreamTest_Reply.ProtoReflect.Descriptor instead.
func (*EchoStreamTest_Reply) GetEcho ¶ added in v2.246.0
func (x *EchoStreamTest_Reply) GetEcho() string
func (*EchoStreamTest_Reply) ProtoMessage ¶ added in v2.246.0
func (*EchoStreamTest_Reply) ProtoMessage()
func (*EchoStreamTest_Reply) ProtoReflect ¶ added in v2.470.4
func (x *EchoStreamTest_Reply) ProtoReflect() protoreflect.Message
func (*EchoStreamTest_Reply) Reset ¶ added in v2.246.0
func (x *EchoStreamTest_Reply) Reset()
func (*EchoStreamTest_Reply) String ¶ added in v2.246.0
func (x *EchoStreamTest_Reply) String() string
type EchoStreamTest_Request ¶ added in v2.246.0
type EchoStreamTest_Request struct { Delay int64 `protobuf:"varint,1,opt,name=delay,proto3" json:"delay,omitempty"` Echo string `protobuf:"bytes,2,opt,name=echo,proto3" json:"echo,omitempty"` TriggerError bool `protobuf:"varint,3,opt,name=trigger_error,json=triggerError,proto3" json:"trigger_error,omitempty"` // contains filtered or unexported fields }
func (*EchoStreamTest_Request) Descriptor
deprecated
added in
v2.246.0
func (*EchoStreamTest_Request) Descriptor() ([]byte, []int)
Deprecated: Use EchoStreamTest_Request.ProtoReflect.Descriptor instead.
func (*EchoStreamTest_Request) GetDelay ¶ added in v2.246.0
func (x *EchoStreamTest_Request) GetDelay() int64
func (*EchoStreamTest_Request) GetEcho ¶ added in v2.246.0
func (x *EchoStreamTest_Request) GetEcho() string
func (*EchoStreamTest_Request) GetTriggerError ¶ added in v2.246.0
func (x *EchoStreamTest_Request) GetTriggerError() bool
func (*EchoStreamTest_Request) ProtoMessage ¶ added in v2.246.0
func (*EchoStreamTest_Request) ProtoMessage()
func (*EchoStreamTest_Request) ProtoReflect ¶ added in v2.470.4
func (x *EchoStreamTest_Request) ProtoReflect() protoreflect.Message
func (*EchoStreamTest_Request) Reset ¶ added in v2.246.0
func (x *EchoStreamTest_Request) Reset()
func (*EchoStreamTest_Request) String ¶ added in v2.246.0
func (x *EchoStreamTest_Request) String() string
type EchoTest ¶ added in v2.246.0
type EchoTest struct {
// contains filtered or unexported fields
}
func (*EchoTest) Descriptor
deprecated
added in
v2.246.0
func (*EchoTest) ProtoMessage ¶ added in v2.246.0
func (*EchoTest) ProtoMessage()
func (*EchoTest) ProtoReflect ¶ added in v2.470.4
func (x *EchoTest) ProtoReflect() protoreflect.Message
type EchoTest_Reply ¶ added in v2.246.0
type EchoTest_Reply struct { Echo string `protobuf:"bytes,1,opt,name=echo,proto3" json:"echo,omitempty"` // contains filtered or unexported fields }
func (*EchoTest_Reply) Descriptor
deprecated
added in
v2.246.0
func (*EchoTest_Reply) Descriptor() ([]byte, []int)
Deprecated: Use EchoTest_Reply.ProtoReflect.Descriptor instead.
func (*EchoTest_Reply) GetEcho ¶ added in v2.246.0
func (x *EchoTest_Reply) GetEcho() string
func (*EchoTest_Reply) ProtoMessage ¶ added in v2.246.0
func (*EchoTest_Reply) ProtoMessage()
func (*EchoTest_Reply) ProtoReflect ¶ added in v2.470.4
func (x *EchoTest_Reply) ProtoReflect() protoreflect.Message
func (*EchoTest_Reply) Reset ¶ added in v2.246.0
func (x *EchoTest_Reply) Reset()
func (*EchoTest_Reply) String ¶ added in v2.246.0
func (x *EchoTest_Reply) String() string
type EchoTest_Request ¶ added in v2.246.0
type EchoTest_Request struct { Delay int64 `protobuf:"varint,1,opt,name=delay,proto3" json:"delay,omitempty"` Echo string `protobuf:"bytes,2,opt,name=echo,proto3" json:"echo,omitempty"` TriggerError bool `protobuf:"varint,3,opt,name=trigger_error,json=triggerError,proto3" json:"trigger_error,omitempty"` // contains filtered or unexported fields }
func (*EchoTest_Request) Descriptor
deprecated
added in
v2.246.0
func (*EchoTest_Request) Descriptor() ([]byte, []int)
Deprecated: Use EchoTest_Request.ProtoReflect.Descriptor instead.
func (*EchoTest_Request) GetDelay ¶ added in v2.246.0
func (x *EchoTest_Request) GetDelay() int64
func (*EchoTest_Request) GetEcho ¶ added in v2.246.0
func (x *EchoTest_Request) GetEcho() string
func (*EchoTest_Request) GetTriggerError ¶ added in v2.246.0
func (x *EchoTest_Request) GetTriggerError() bool
func (*EchoTest_Request) ProtoMessage ¶ added in v2.246.0
func (*EchoTest_Request) ProtoMessage()
func (*EchoTest_Request) ProtoReflect ¶ added in v2.470.4
func (x *EchoTest_Request) ProtoReflect() protoreflect.Message
func (*EchoTest_Request) Reset ¶ added in v2.246.0
func (x *EchoTest_Request) Reset()
func (*EchoTest_Request) String ¶ added in v2.246.0
func (x *EchoTest_Request) String() string
type TestServiceClient ¶ added in v2.246.0
type TestServiceClient interface { // use to test unary EchoTest(ctx context.Context, in *EchoTest_Request, opts ...grpc.CallOption) (*EchoTest_Reply, error) // Use to test stream. EchoStreamTest(ctx context.Context, in *EchoStreamTest_Request, opts ...grpc.CallOption) (grpc.ServerStreamingClient[EchoStreamTest_Reply], error) // Use to test duplex stream. EchoDuplexTest(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[EchoDuplexTest_Request, EchoDuplexTest_Reply], error) }
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.
func NewTestServiceClient ¶ added in v2.246.0
func NewTestServiceClient(cc grpc.ClientConnInterface) TestServiceClient
type TestServiceServer ¶ added in v2.246.0
type TestServiceServer interface { // use to test unary EchoTest(context.Context, *EchoTest_Request) (*EchoTest_Reply, error) // Use to test stream. EchoStreamTest(*EchoStreamTest_Request, grpc.ServerStreamingServer[EchoStreamTest_Reply]) error // Use to test duplex stream. EchoDuplexTest(grpc.BidiStreamingServer[EchoDuplexTest_Request, EchoDuplexTest_Reply]) error // contains filtered or unexported methods }
TestServiceServer is the server API for TestService service. All implementations must embed UnimplementedTestServiceServer for forward compatibility.
func NewService ¶ added in v2.246.0
func NewService(opts *Options) TestServiceServer
type TestService_EchoDuplexTestClient ¶ added in v2.246.0
type TestService_EchoDuplexTestClient = grpc.BidiStreamingClient[EchoDuplexTest_Request, EchoDuplexTest_Reply]
This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type TestService_EchoDuplexTestServer ¶ added in v2.246.0
type TestService_EchoDuplexTestServer = grpc.BidiStreamingServer[EchoDuplexTest_Request, EchoDuplexTest_Reply]
This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type TestService_EchoStreamTestClient ¶ added in v2.246.0
type TestService_EchoStreamTestClient = grpc.ServerStreamingClient[EchoStreamTest_Reply]
This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type TestService_EchoStreamTestServer ¶ added in v2.246.0
type TestService_EchoStreamTestServer = grpc.ServerStreamingServer[EchoStreamTest_Reply]
This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type UnimplementedTestServiceServer ¶ added in v2.246.0
type UnimplementedTestServiceServer struct{}
UnimplementedTestServiceServer must be embedded to have forward compatible implementations.
NOTE: this should be embedded by value instead of pointer to avoid a nil pointer dereference when methods are called.
func (UnimplementedTestServiceServer) EchoDuplexTest ¶ added in v2.246.0
func (UnimplementedTestServiceServer) EchoDuplexTest(grpc.BidiStreamingServer[EchoDuplexTest_Request, EchoDuplexTest_Reply]) error
func (UnimplementedTestServiceServer) EchoStreamTest ¶ added in v2.246.0
func (UnimplementedTestServiceServer) EchoStreamTest(*EchoStreamTest_Request, grpc.ServerStreamingServer[EchoStreamTest_Reply]) error
func (UnimplementedTestServiceServer) EchoTest ¶ added in v2.246.0
func (UnimplementedTestServiceServer) EchoTest(context.Context, *EchoTest_Request) (*EchoTest_Reply, error)
type UnsafeTestServiceServer ¶ added in v2.455.0
type UnsafeTestServiceServer interface {
// contains filtered or unexported methods
}
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.