testpb

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2023 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

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

Functions

func RegisterTestServiceServer

func RegisterTestServiceServer(s *grpc.Server, srv TestServiceServer)

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 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 (*TestPingService) PingEmpty

func (*TestPingService) PingError

func (*TestPingService) PingList

func (*TestPingService) PingStream

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

type TestServiceClient

type TestServiceClient interface {
	PingEmpty(ctx context.Context, in *PingEmptyRequest, opts ...grpc.CallOption) (*PingEmptyResponse, error)
	Ping(ctx context.Context, in *PingRequest, opts ...grpc.CallOption) (*PingResponse, error)
	PingError(ctx context.Context, in *PingErrorRequest, opts ...grpc.CallOption) (*PingErrorResponse, error)
	PingList(ctx context.Context, in *PingListRequest, 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.

type TestServiceServer

type TestServiceServer interface {
	PingEmpty(context.Context, *PingEmptyRequest) (*PingEmptyResponse, error)
	Ping(context.Context, *PingRequest) (*PingResponse, error)
	PingError(context.Context, *PingErrorRequest) (*PingErrorResponse, error)
	PingList(*PingListRequest, 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() (*PingListResponse, error)
	grpc.ClientStream
}

type TestService_PingListServer

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

type TestService_PingStreamClient

type TestService_PingStreamClient interface {
	Send(*PingStreamRequest) error
	Recv() (*PingStreamResponse, error)
	grpc.ClientStream
}

type TestService_PingStreamServer

type TestService_PingStreamServer interface {
	Send(*PingStreamResponse) error
	Recv() (*PingStreamRequest, 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) PingStream

Jump to

Keyboard shortcuts

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