testproto

package
v0.4.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 15, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultResponseValue is the default value used.
	DefaultResponseValue = "default_response_value"
	// ListResponseCount is the expected number of responses to PingList
	ListResponseCount = 100
)

Variables

View Source
var File_testproto_test_proto protoreflect.FileDescriptor
View Source
var TestService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "TestService",
	HandlerType: (*TestServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "PingEmpty",
			Handler:    _TestService_PingEmpty_Handler,
		},
		{
			MethodName: "Ping",
			Handler:    _TestService_Ping_Handler,
		},
		{
			MethodName: "PingError",
			Handler:    _TestService_PingError_Handler,
		},
		{
			MethodName: "PingPanic",
			Handler:    _TestService_PingPanic_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "PingList",
			Handler:       _TestService_PingList_Handler,
			ServerStreams: true,
		},
		{
			StreamName:    "PingStream",
			Handler:       _TestService_PingStream_Handler,
			ServerStreams: true,
			ClientStreams: true,
		},
	},
	Metadata: "testproto/test.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 NewPingGrpcService added in v0.1.0

func NewPingGrpcService(t *testing.T, opts ...grpc.ServerOption) (server *grpc.Server, addr string)

func RegisterTestServiceServer

func RegisterTestServiceServer(s grpc.ServiceRegistrar, srv TestServiceServer)

Types

type Empty

type Empty struct {
	// contains filtered or unexported fields
}

func (*Empty) Descriptor deprecated

func (*Empty) Descriptor() ([]byte, []int)

Deprecated: Use Empty.ProtoReflect.Descriptor instead.

func (*Empty) ProtoMessage

func (*Empty) ProtoMessage()

func (*Empty) ProtoReflect

func (x *Empty) ProtoReflect() protoreflect.Message

func (*Empty) Reset

func (x *Empty) Reset()

func (*Empty) String

func (x *Empty) String() string

type PingRequest

type PingRequest struct {
	Value             string `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"`
	SleepTimeMs       int32  `protobuf:"varint,2,opt,name=sleep_time_ms,json=sleepTimeMs,proto3" json:"sleep_time_ms,omitempty"`
	ErrorCodeReturned uint32 `protobuf:"varint,3,opt,name=error_code_returned,json=errorCodeReturned,proto3" json:"error_code_returned,omitempty"`
	// contains filtered or unexported fields
}

func (*PingRequest) Descriptor deprecated

func (*PingRequest) Descriptor() ([]byte, []int)

Deprecated: Use PingRequest.ProtoReflect.Descriptor instead.

func (*PingRequest) GetErrorCodeReturned

func (x *PingRequest) GetErrorCodeReturned() uint32

func (*PingRequest) GetSleepTimeMs

func (x *PingRequest) GetSleepTimeMs() int32

func (*PingRequest) GetValue

func (x *PingRequest) GetValue() string

func (*PingRequest) ProtoMessage

func (*PingRequest) ProtoMessage()

func (*PingRequest) ProtoReflect

func (x *PingRequest) ProtoReflect() protoreflect.Message

func (*PingRequest) Reset

func (x *PingRequest) Reset()

func (*PingRequest) String

func (x *PingRequest) String() string

type PingResponse

type PingResponse struct {
	Value   string `protobuf:"bytes,1,opt,name=Value,proto3" json:"Value,omitempty"`
	Counter int32  `protobuf:"varint,2,opt,name=counter,proto3" json:"counter,omitempty"`
	// contains filtered or unexported fields
}

func (*PingResponse) Descriptor deprecated

func (*PingResponse) Descriptor() ([]byte, []int)

Deprecated: Use PingResponse.ProtoReflect.Descriptor instead.

func (*PingResponse) GetCounter

func (x *PingResponse) GetCounter() int32

func (*PingResponse) GetValue

func (x *PingResponse) GetValue() string

func (*PingResponse) ProtoMessage

func (*PingResponse) ProtoMessage()

func (*PingResponse) ProtoReflect

func (x *PingResponse) ProtoReflect() protoreflect.Message

func (*PingResponse) Reset

func (x *PingResponse) Reset()

func (*PingResponse) String

func (x *PingResponse) String() string

type TestPingService added in v0.0.3

type TestPingService struct {
	T *testing.T
	UnimplementedTestServiceServer
}

func (*TestPingService) Ping added in v0.0.3

func (s *TestPingService) Ping(ctx context.Context, ping *PingRequest) (*PingResponse, error)

func (*TestPingService) PingEmpty added in v0.0.3

func (s *TestPingService) PingEmpty(ctx context.Context, _ *Empty) (*PingResponse, error)

func (*TestPingService) PingError added in v0.0.3

func (s *TestPingService) PingError(ctx context.Context, ping *PingRequest) (*Empty, error)

func (*TestPingService) PingList added in v0.0.3

func (s *TestPingService) PingList(ping *PingRequest, stream TestService_PingListServer) error

func (*TestPingService) PingPanic added in v0.0.3

func (s *TestPingService) PingPanic(ctx context.Context, ping *PingRequest) (*Empty, error)

func (*TestPingService) PingStream added in v0.0.3

func (s *TestPingService) PingStream(stream TestService_PingStreamServer) error

type TestServiceClient

type TestServiceClient interface {
	PingEmpty(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*PingResponse, error)
	Ping(ctx context.Context, in *PingRequest, opts ...grpc.CallOption) (*PingResponse, error)
	PingError(ctx context.Context, in *PingRequest, opts ...grpc.CallOption) (*Empty, error)
	PingPanic(ctx context.Context, in *PingRequest, opts ...grpc.CallOption) (*Empty, error)
	PingList(ctx context.Context, in *PingRequest, opts ...grpc.CallOption) (TestService_PingListClient, error)
	PingStream(ctx context.Context, opts ...grpc.CallOption) (TestService_PingStreamClient, 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 NewPingGrpcClient added in v0.1.0

func NewPingGrpcClient(t *testing.T, ctx context.Context, addr string, opts ...grpc.DialOption) (conn *grpc.ClientConn, client TestServiceClient)

type TestServiceServer

type TestServiceServer interface {
	PingEmpty(context.Context, *Empty) (*PingResponse, error)
	Ping(context.Context, *PingRequest) (*PingResponse, error)
	PingError(context.Context, *PingRequest) (*Empty, error)
	PingPanic(context.Context, *PingRequest) (*Empty, error)
	PingList(*PingRequest, TestService_PingListServer) error
	PingStream(TestService_PingStreamServer) error
	// contains filtered or unexported methods
}

TestServiceServer is the server API for TestService service. All implementations must embed UnimplementedTestServiceServer for forward compatibility

type TestService_PingListClient

type TestService_PingListClient interface {
	Recv() (*PingResponse, error)
	grpc.ClientStream
}

type TestService_PingListServer

type TestService_PingListServer interface {
	Send(*PingResponse) error
	grpc.ServerStream
}

type TestService_PingStreamClient

type TestService_PingStreamClient interface {
	Send(*PingRequest) error
	Recv() (*PingResponse, error)
	grpc.ClientStream
}

type TestService_PingStreamServer

type TestService_PingStreamServer interface {
	Send(*PingResponse) error
	Recv() (*PingRequest, error)
	grpc.ServerStream
}

type UnimplementedTestServiceServer

type UnimplementedTestServiceServer struct {
}

UnimplementedTestServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedTestServiceServer) Ping

func (UnimplementedTestServiceServer) PingEmpty

func (UnimplementedTestServiceServer) PingError

func (UnimplementedTestServiceServer) PingList

func (UnimplementedTestServiceServer) PingPanic

func (UnimplementedTestServiceServer) PingStream

type UnsafeTestServiceServer

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL