testpb

package
v2.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2024 License: Apache-2.0 Imports: 25 Imported by: 9

Documentation

Index

Constants

View Source
const (
	TestService_PingEmpty_FullMethodName        = "/testing.testpb.v1.TestService/PingEmpty"
	TestService_Ping_FullMethodName             = "/testing.testpb.v1.TestService/Ping"
	TestService_PingError_FullMethodName        = "/testing.testpb.v1.TestService/PingError"
	TestService_PingList_FullMethodName         = "/testing.testpb.v1.TestService/PingList"
	TestService_PingStream_FullMethodName       = "/testing.testpb.v1.TestService/PingStream"
	TestService_PingClientStream_FullMethodName = "/testing.testpb.v1.TestService/PingClientStream"
)
View Source
const (
	// ListResponseCount is the expected number of responses to PingList
	ListResponseCount = 100
)

Variables

View Source
var (
	GoodPing       = &PingRequest{Value: "something", SleepTimeMs: 9999}
	GoodPingError  = &PingErrorRequest{Value: "something", SleepTimeMs: 9999}
	GoodPingList   = &PingListRequest{Value: "something", SleepTimeMs: 9999}
	GoodPingStream = &PingStreamRequest{Value: "something", SleepTimeMs: 9999}

	BadPing       = &PingRequest{Value: "something", SleepTimeMs: 10001}
	BadPingError  = &PingErrorRequest{Value: "something", SleepTimeMs: 10001}
	BadPingList   = &PingListRequest{Value: "something", SleepTimeMs: 10001}
	BadPingStream = &PingStreamRequest{Value: "something", SleepTimeMs: 10001}

	GoodPingResponse = &PingResponse{Counter: 100}
	BadPingResponse  = &PingResponse{Counter: math.MaxInt16 + 1}
)
View Source
var TestServiceFullName = TestService_ServiceDesc.ServiceName
View Source
var TestService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "testing.testpb.v1.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,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "PingList",
			Handler:       _TestService_PingList_Handler,
			ServerStreams: true,
		},
		{
			StreamName:    "PingStream",
			Handler:       _TestService_PingStream_Handler,
			ServerStreams: true,
			ClientStreams: true,
		},
		{
			StreamName:    "PingClientStream",
			Handler:       _TestService_PingClientStream_Handler,
			ClientStreams: true,
		},
	},
	Metadata: "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 ExtractCtxTestNumber added in v2.2.0

func ExtractCtxTestNumber(ctx context.Context) *int

func ExtractErrorFields added in v2.2.0

func ExtractErrorFields(err error) []any

func RegisterTestServiceServer

func RegisterTestServiceServer(s grpc.ServiceRegistrar, srv TestServiceServer)

func UnaryServerInterceptor added in v2.2.0

func UnaryServerInterceptor() grpc.UnaryServerInterceptor

UnaryServerInterceptor returns a new unary server interceptors that adds query information logging.

func WrapFieldsInError added in v2.2.0

func WrapFieldsInError(err error, fields []any) error

Types

type InterceptorTestSuite

type InterceptorTestSuite struct {
	suite.Suite

	TestService TestServiceServer
	ServerOpts  []grpc.ServerOption
	ClientOpts  []grpc.DialOption

	ServerListener net.Listener
	Server         *grpc.Server

	Client TestServiceClient
	// contains filtered or unexported fields
}

InterceptorTestSuite is a testify/Suite that starts a gRPC PingService server and a client.

func (*InterceptorTestSuite) DeadlineCtx

func (s *InterceptorTestSuite) DeadlineCtx(deadline time.Time) context.Context

func (*InterceptorTestSuite) NewClient

func (s *InterceptorTestSuite) NewClient(dialOpts ...grpc.DialOption) TestServiceClient

func (*InterceptorTestSuite) RestartServer

func (s *InterceptorTestSuite) RestartServer(delayedStart time.Duration) <-chan bool

func (*InterceptorTestSuite) ServerAddr

func (s *InterceptorTestSuite) ServerAddr() string

func (*InterceptorTestSuite) SetupSuite

func (s *InterceptorTestSuite) SetupSuite()

func (*InterceptorTestSuite) SimpleCtx

func (s *InterceptorTestSuite) SimpleCtx() context.Context

func (*InterceptorTestSuite) TearDownSuite

func (s *InterceptorTestSuite) TearDownSuite()

type PingClientStreamRequest added in v2.2.0

type PingClientStreamRequest 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 (*PingClientStreamRequest) Descriptor deprecated added in v2.2.0

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

Deprecated: Use PingClientStreamRequest.ProtoReflect.Descriptor instead.

func (*PingClientStreamRequest) GetErrorCodeReturned added in v2.2.0

func (x *PingClientStreamRequest) GetErrorCodeReturned() uint32

func (*PingClientStreamRequest) GetSleepTimeMs added in v2.2.0

func (x *PingClientStreamRequest) GetSleepTimeMs() int32

func (*PingClientStreamRequest) GetValue added in v2.2.0

func (x *PingClientStreamRequest) GetValue() string

func (*PingClientStreamRequest) ProtoMessage added in v2.2.0

func (*PingClientStreamRequest) ProtoMessage()

func (*PingClientStreamRequest) ProtoReflect added in v2.2.0

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

func (*PingClientStreamRequest) Reset added in v2.2.0

func (x *PingClientStreamRequest) Reset()

func (*PingClientStreamRequest) String added in v2.2.0

func (x *PingClientStreamRequest) String() string

type PingClientStreamResponse added in v2.2.0

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

func (*PingClientStreamResponse) Descriptor deprecated added in v2.2.0

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

Deprecated: Use PingClientStreamResponse.ProtoReflect.Descriptor instead.

func (*PingClientStreamResponse) GetCounter added in v2.2.0

func (x *PingClientStreamResponse) GetCounter() int32

func (*PingClientStreamResponse) ProtoMessage added in v2.2.0

func (*PingClientStreamResponse) ProtoMessage()

func (*PingClientStreamResponse) ProtoReflect added in v2.2.0

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

func (*PingClientStreamResponse) Reset added in v2.2.0

func (x *PingClientStreamResponse) Reset()

func (*PingClientStreamResponse) String added in v2.2.0

func (x *PingClientStreamResponse) String() string

type PingEmptyRequest

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

func (*PingEmptyRequest) Descriptor deprecated

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

Deprecated: Use PingEmptyRequest.ProtoReflect.Descriptor instead.

func (*PingEmptyRequest) ProtoMessage

func (*PingEmptyRequest) ProtoMessage()

func (*PingEmptyRequest) ProtoReflect

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

func (*PingEmptyRequest) Reset

func (x *PingEmptyRequest) Reset()

func (*PingEmptyRequest) String

func (x *PingEmptyRequest) String() string

type PingEmptyResponse

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

func (*PingEmptyResponse) Descriptor deprecated

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

Deprecated: Use PingEmptyResponse.ProtoReflect.Descriptor instead.

func (*PingEmptyResponse) ProtoMessage

func (*PingEmptyResponse) ProtoMessage()

func (*PingEmptyResponse) ProtoReflect

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

func (*PingEmptyResponse) Reset

func (x *PingEmptyResponse) Reset()

func (*PingEmptyResponse) String

func (x *PingEmptyResponse) String() string

type PingErrorRequest

type PingErrorRequest 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 (*PingErrorRequest) Descriptor deprecated

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

Deprecated: Use PingErrorRequest.ProtoReflect.Descriptor instead.

func (*PingErrorRequest) GetErrorCodeReturned

func (x *PingErrorRequest) GetErrorCodeReturned() uint32

func (*PingErrorRequest) GetSleepTimeMs

func (x *PingErrorRequest) GetSleepTimeMs() int32

func (*PingErrorRequest) GetValue

func (x *PingErrorRequest) GetValue() string

func (*PingErrorRequest) ProtoMessage

func (*PingErrorRequest) ProtoMessage()

func (*PingErrorRequest) ProtoReflect

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

func (*PingErrorRequest) Reset

func (x *PingErrorRequest) Reset()

func (*PingErrorRequest) String

func (x *PingErrorRequest) String() string

func (*PingErrorRequest) Validate

func (x *PingErrorRequest) Validate() error

type PingErrorResponse

type PingErrorResponse 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 (*PingErrorResponse) Descriptor deprecated

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

Deprecated: Use PingErrorResponse.ProtoReflect.Descriptor instead.

func (*PingErrorResponse) GetCounter

func (x *PingErrorResponse) GetCounter() int32

func (*PingErrorResponse) GetValue

func (x *PingErrorResponse) GetValue() string

func (*PingErrorResponse) ProtoMessage

func (*PingErrorResponse) ProtoMessage()

func (*PingErrorResponse) ProtoReflect

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

func (*PingErrorResponse) Reset

func (x *PingErrorResponse) Reset()

func (*PingErrorResponse) String

func (x *PingErrorResponse) String() string

type PingListRequest

type PingListRequest 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 (*PingListRequest) Descriptor deprecated

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

Deprecated: Use PingListRequest.ProtoReflect.Descriptor instead.

func (*PingListRequest) GetErrorCodeReturned

func (x *PingListRequest) GetErrorCodeReturned() uint32

func (*PingListRequest) GetSleepTimeMs

func (x *PingListRequest) GetSleepTimeMs() int32

func (*PingListRequest) GetValue

func (x *PingListRequest) GetValue() string

func (*PingListRequest) ProtoMessage

func (*PingListRequest) ProtoMessage()

func (*PingListRequest) ProtoReflect

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

func (*PingListRequest) Reset

func (x *PingListRequest) Reset()

func (*PingListRequest) String

func (x *PingListRequest) String() string

func (*PingListRequest) Validate

func (x *PingListRequest) Validate(bool) error

type PingListResponse

type PingListResponse 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 (*PingListResponse) Descriptor deprecated

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

Deprecated: Use PingListResponse.ProtoReflect.Descriptor instead.

func (*PingListResponse) GetCounter

func (x *PingListResponse) GetCounter() int32

func (*PingListResponse) GetValue

func (x *PingListResponse) GetValue() string

func (*PingListResponse) ProtoMessage

func (*PingListResponse) ProtoMessage()

func (*PingListResponse) ProtoReflect

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

func (*PingListResponse) Reset

func (x *PingListResponse) Reset()

func (*PingListResponse) String

func (x *PingListResponse) 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

func (*PingRequest) Validate

func (x *PingRequest) Validate(bool) error

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

func (*PingResponse) Validate

func (x *PingResponse) Validate() error

Validate implements the legacy validation interface from protoc-gen-validate.

func (*PingResponse) ValidateAll

func (x *PingResponse) ValidateAll() error

ValidateAll implements the new ValidateAll interface from protoc-gen-validate.

type PingStreamRequest

type PingStreamRequest 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 (*PingStreamRequest) Descriptor deprecated

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

Deprecated: Use PingStreamRequest.ProtoReflect.Descriptor instead.

func (*PingStreamRequest) GetErrorCodeReturned

func (x *PingStreamRequest) GetErrorCodeReturned() uint32

func (*PingStreamRequest) GetSleepTimeMs

func (x *PingStreamRequest) GetSleepTimeMs() int32

func (*PingStreamRequest) GetValue

func (x *PingStreamRequest) GetValue() string

func (*PingStreamRequest) ProtoMessage

func (*PingStreamRequest) ProtoMessage()

func (*PingStreamRequest) ProtoReflect

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

func (*PingStreamRequest) Reset

func (x *PingStreamRequest) Reset()

func (*PingStreamRequest) String

func (x *PingStreamRequest) String() string

func (*PingStreamRequest) Validate

func (x *PingStreamRequest) Validate(bool) error

type PingStreamResponse

type PingStreamResponse 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 (*PingStreamResponse) Descriptor deprecated

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

Deprecated: Use PingStreamResponse.ProtoReflect.Descriptor instead.

func (*PingStreamResponse) GetCounter

func (x *PingStreamResponse) GetCounter() int32

func (*PingStreamResponse) GetValue

func (x *PingStreamResponse) GetValue() string

func (*PingStreamResponse) ProtoMessage

func (*PingStreamResponse) ProtoMessage()

func (*PingStreamResponse) ProtoReflect

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

func (*PingStreamResponse) Reset

func (x *PingStreamResponse) Reset()

func (*PingStreamResponse) String

func (x *PingStreamResponse) String() string

type TestPingService

type TestPingService struct {
	UnimplementedTestServiceServer
}

func (*TestPingService) Ping

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

func (*TestPingService) PingClientStream added in v2.2.0

func (s *TestPingService) PingClientStream(stream TestService_PingClientStreamServer) error

func (*TestPingService) PingEmpty

func (*TestPingService) PingError

func (*TestPingService) PingList

func (*TestPingService) PingStream

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

type TestServiceClient

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 TestServiceServer

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

type TestService_PingClientStreamClient added in v2.2.0

type TestService_PingClientStreamClient = grpc.ClientStreamingClient[PingClientStreamRequest, PingClientStreamResponse]

This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.

type TestService_PingClientStreamServer added in v2.2.0

type TestService_PingClientStreamServer = grpc.ClientStreamingServer[PingClientStreamRequest, PingClientStreamResponse]

This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.

type TestService_PingListClient

type TestService_PingListClient = grpc.ServerStreamingClient[PingListResponse]

This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.

type TestService_PingListServer

type TestService_PingListServer = grpc.ServerStreamingServer[PingListResponse]

This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.

type TestService_PingStreamClient

type TestService_PingStreamClient = grpc.BidiStreamingClient[PingStreamRequest, PingStreamResponse]

This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.

type TestService_PingStreamServer

type TestService_PingStreamServer = grpc.BidiStreamingServer[PingStreamRequest, PingStreamResponse]

This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.

type UnimplementedTestServiceServer

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) Ping

func (UnimplementedTestServiceServer) PingClientStream added in v2.2.0

func (UnimplementedTestServiceServer) PingEmpty

func (UnimplementedTestServiceServer) PingError

type UnsafeTestServiceServer added in v2.2.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.

Jump to

Keyboard shortcuts

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