testutil

package
v2.468.11 Latest Latest
Warning

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

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

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

This section is empty.

Variables

View Source
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)

func TestingNewServiceClient added in v2.246.0

func TestingNewServiceClient(ctx context.Context, t *testing.T, opts *Options) (*grpc.ClientConn, *grpc.Server)

Types

type EchoDuplexTest added in v2.246.0

type EchoDuplexTest struct {
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*EchoDuplexTest) Descriptor added in v2.246.0

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

func (*EchoDuplexTest) ProtoMessage added in v2.246.0

func (*EchoDuplexTest) ProtoMessage()

func (*EchoDuplexTest) Reset added in v2.246.0

func (m *EchoDuplexTest) Reset()

func (*EchoDuplexTest) String added in v2.246.0

func (m *EchoDuplexTest) String() string

func (*EchoDuplexTest) XXX_DiscardUnknown added in v2.246.0

func (m *EchoDuplexTest) XXX_DiscardUnknown()

func (*EchoDuplexTest) XXX_Marshal added in v2.246.0

func (m *EchoDuplexTest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*EchoDuplexTest) XXX_Merge added in v2.246.0

func (m *EchoDuplexTest) XXX_Merge(src proto.Message)

func (*EchoDuplexTest) XXX_Size added in v2.246.0

func (m *EchoDuplexTest) XXX_Size() int

func (*EchoDuplexTest) XXX_Unmarshal added in v2.246.0

func (m *EchoDuplexTest) XXX_Unmarshal(b []byte) error

type EchoDuplexTest_Reply added in v2.246.0

type EchoDuplexTest_Reply struct {
	Echo                 string   `protobuf:"bytes,1,opt,name=echo,proto3" json:"echo,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*EchoDuplexTest_Reply) Descriptor added in v2.246.0

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

func (*EchoDuplexTest_Reply) GetEcho added in v2.246.0

func (m *EchoDuplexTest_Reply) GetEcho() string

func (*EchoDuplexTest_Reply) ProtoMessage added in v2.246.0

func (*EchoDuplexTest_Reply) ProtoMessage()

func (*EchoDuplexTest_Reply) Reset added in v2.246.0

func (m *EchoDuplexTest_Reply) Reset()

func (*EchoDuplexTest_Reply) String added in v2.246.0

func (m *EchoDuplexTest_Reply) String() string

func (*EchoDuplexTest_Reply) XXX_DiscardUnknown added in v2.246.0

func (m *EchoDuplexTest_Reply) XXX_DiscardUnknown()

func (*EchoDuplexTest_Reply) XXX_Marshal added in v2.246.0

func (m *EchoDuplexTest_Reply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*EchoDuplexTest_Reply) XXX_Merge added in v2.246.0

func (m *EchoDuplexTest_Reply) XXX_Merge(src proto.Message)

func (*EchoDuplexTest_Reply) XXX_Size added in v2.246.0

func (m *EchoDuplexTest_Reply) XXX_Size() int

func (*EchoDuplexTest_Reply) XXX_Unmarshal added in v2.246.0

func (m *EchoDuplexTest_Reply) XXX_Unmarshal(b []byte) error

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"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*EchoDuplexTest_Request) Descriptor added in v2.246.0

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

func (*EchoDuplexTest_Request) GetEcho added in v2.246.0

func (m *EchoDuplexTest_Request) GetEcho() string

func (*EchoDuplexTest_Request) GetTriggerError added in v2.246.0

func (m *EchoDuplexTest_Request) GetTriggerError() bool

func (*EchoDuplexTest_Request) ProtoMessage added in v2.246.0

func (*EchoDuplexTest_Request) ProtoMessage()

func (*EchoDuplexTest_Request) Reset added in v2.246.0

func (m *EchoDuplexTest_Request) Reset()

func (*EchoDuplexTest_Request) String added in v2.246.0

func (m *EchoDuplexTest_Request) String() string

func (*EchoDuplexTest_Request) XXX_DiscardUnknown added in v2.246.0

func (m *EchoDuplexTest_Request) XXX_DiscardUnknown()

func (*EchoDuplexTest_Request) XXX_Marshal added in v2.246.0

func (m *EchoDuplexTest_Request) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*EchoDuplexTest_Request) XXX_Merge added in v2.246.0

func (m *EchoDuplexTest_Request) XXX_Merge(src proto.Message)

func (*EchoDuplexTest_Request) XXX_Size added in v2.246.0

func (m *EchoDuplexTest_Request) XXX_Size() int

func (*EchoDuplexTest_Request) XXX_Unmarshal added in v2.246.0

func (m *EchoDuplexTest_Request) XXX_Unmarshal(b []byte) error

type EchoStreamTest added in v2.246.0

type EchoStreamTest struct {
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*EchoStreamTest) Descriptor added in v2.246.0

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

func (*EchoStreamTest) ProtoMessage added in v2.246.0

func (*EchoStreamTest) ProtoMessage()

func (*EchoStreamTest) Reset added in v2.246.0

func (m *EchoStreamTest) Reset()

func (*EchoStreamTest) String added in v2.246.0

func (m *EchoStreamTest) String() string

func (*EchoStreamTest) XXX_DiscardUnknown added in v2.246.0

func (m *EchoStreamTest) XXX_DiscardUnknown()

func (*EchoStreamTest) XXX_Marshal added in v2.246.0

func (m *EchoStreamTest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*EchoStreamTest) XXX_Merge added in v2.246.0

func (m *EchoStreamTest) XXX_Merge(src proto.Message)

func (*EchoStreamTest) XXX_Size added in v2.246.0

func (m *EchoStreamTest) XXX_Size() int

func (*EchoStreamTest) XXX_Unmarshal added in v2.246.0

func (m *EchoStreamTest) XXX_Unmarshal(b []byte) error

type EchoStreamTest_Reply added in v2.246.0

type EchoStreamTest_Reply struct {
	Echo                 string   `protobuf:"bytes,1,opt,name=echo,proto3" json:"echo,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*EchoStreamTest_Reply) Descriptor added in v2.246.0

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

func (*EchoStreamTest_Reply) GetEcho added in v2.246.0

func (m *EchoStreamTest_Reply) GetEcho() string

func (*EchoStreamTest_Reply) ProtoMessage added in v2.246.0

func (*EchoStreamTest_Reply) ProtoMessage()

func (*EchoStreamTest_Reply) Reset added in v2.246.0

func (m *EchoStreamTest_Reply) Reset()

func (*EchoStreamTest_Reply) String added in v2.246.0

func (m *EchoStreamTest_Reply) String() string

func (*EchoStreamTest_Reply) XXX_DiscardUnknown added in v2.246.0

func (m *EchoStreamTest_Reply) XXX_DiscardUnknown()

func (*EchoStreamTest_Reply) XXX_Marshal added in v2.246.0

func (m *EchoStreamTest_Reply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*EchoStreamTest_Reply) XXX_Merge added in v2.246.0

func (m *EchoStreamTest_Reply) XXX_Merge(src proto.Message)

func (*EchoStreamTest_Reply) XXX_Size added in v2.246.0

func (m *EchoStreamTest_Reply) XXX_Size() int

func (*EchoStreamTest_Reply) XXX_Unmarshal added in v2.246.0

func (m *EchoStreamTest_Reply) XXX_Unmarshal(b []byte) error

type EchoStreamTest_Request added in v2.246.0

type EchoStreamTest_Request struct {
	Delay                uint64   `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"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*EchoStreamTest_Request) Descriptor added in v2.246.0

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

func (*EchoStreamTest_Request) GetDelay added in v2.246.0

func (m *EchoStreamTest_Request) GetDelay() uint64

func (*EchoStreamTest_Request) GetEcho added in v2.246.0

func (m *EchoStreamTest_Request) GetEcho() string

func (*EchoStreamTest_Request) GetTriggerError added in v2.246.0

func (m *EchoStreamTest_Request) GetTriggerError() bool

func (*EchoStreamTest_Request) ProtoMessage added in v2.246.0

func (*EchoStreamTest_Request) ProtoMessage()

func (*EchoStreamTest_Request) Reset added in v2.246.0

func (m *EchoStreamTest_Request) Reset()

func (*EchoStreamTest_Request) String added in v2.246.0

func (m *EchoStreamTest_Request) String() string

func (*EchoStreamTest_Request) XXX_DiscardUnknown added in v2.246.0

func (m *EchoStreamTest_Request) XXX_DiscardUnknown()

func (*EchoStreamTest_Request) XXX_Marshal added in v2.246.0

func (m *EchoStreamTest_Request) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*EchoStreamTest_Request) XXX_Merge added in v2.246.0

func (m *EchoStreamTest_Request) XXX_Merge(src proto.Message)

func (*EchoStreamTest_Request) XXX_Size added in v2.246.0

func (m *EchoStreamTest_Request) XXX_Size() int

func (*EchoStreamTest_Request) XXX_Unmarshal added in v2.246.0

func (m *EchoStreamTest_Request) XXX_Unmarshal(b []byte) error

type EchoTest added in v2.246.0

type EchoTest struct {
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*EchoTest) Descriptor added in v2.246.0

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

func (*EchoTest) ProtoMessage added in v2.246.0

func (*EchoTest) ProtoMessage()

func (*EchoTest) Reset added in v2.246.0

func (m *EchoTest) Reset()

func (*EchoTest) String added in v2.246.0

func (m *EchoTest) String() string

func (*EchoTest) XXX_DiscardUnknown added in v2.246.0

func (m *EchoTest) XXX_DiscardUnknown()

func (*EchoTest) XXX_Marshal added in v2.246.0

func (m *EchoTest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*EchoTest) XXX_Merge added in v2.246.0

func (m *EchoTest) XXX_Merge(src proto.Message)

func (*EchoTest) XXX_Size added in v2.246.0

func (m *EchoTest) XXX_Size() int

func (*EchoTest) XXX_Unmarshal added in v2.246.0

func (m *EchoTest) XXX_Unmarshal(b []byte) error

type EchoTest_Reply added in v2.246.0

type EchoTest_Reply struct {
	Echo                 string   `protobuf:"bytes,1,opt,name=echo,proto3" json:"echo,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*EchoTest_Reply) Descriptor added in v2.246.0

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

func (*EchoTest_Reply) GetEcho added in v2.246.0

func (m *EchoTest_Reply) GetEcho() string

func (*EchoTest_Reply) ProtoMessage added in v2.246.0

func (*EchoTest_Reply) ProtoMessage()

func (*EchoTest_Reply) Reset added in v2.246.0

func (m *EchoTest_Reply) Reset()

func (*EchoTest_Reply) String added in v2.246.0

func (m *EchoTest_Reply) String() string

func (*EchoTest_Reply) XXX_DiscardUnknown added in v2.246.0

func (m *EchoTest_Reply) XXX_DiscardUnknown()

func (*EchoTest_Reply) XXX_Marshal added in v2.246.0

func (m *EchoTest_Reply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*EchoTest_Reply) XXX_Merge added in v2.246.0

func (m *EchoTest_Reply) XXX_Merge(src proto.Message)

func (*EchoTest_Reply) XXX_Size added in v2.246.0

func (m *EchoTest_Reply) XXX_Size() int

func (*EchoTest_Reply) XXX_Unmarshal added in v2.246.0

func (m *EchoTest_Reply) XXX_Unmarshal(b []byte) error

type EchoTest_Request added in v2.246.0

type EchoTest_Request struct {
	Delay                uint64   `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"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*EchoTest_Request) Descriptor added in v2.246.0

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

func (*EchoTest_Request) GetDelay added in v2.246.0

func (m *EchoTest_Request) GetDelay() uint64

func (*EchoTest_Request) GetEcho added in v2.246.0

func (m *EchoTest_Request) GetEcho() string

func (*EchoTest_Request) GetTriggerError added in v2.246.0

func (m *EchoTest_Request) GetTriggerError() bool

func (*EchoTest_Request) ProtoMessage added in v2.246.0

func (*EchoTest_Request) ProtoMessage()

func (*EchoTest_Request) Reset added in v2.246.0

func (m *EchoTest_Request) Reset()

func (*EchoTest_Request) String added in v2.246.0

func (m *EchoTest_Request) String() string

func (*EchoTest_Request) XXX_DiscardUnknown added in v2.246.0

func (m *EchoTest_Request) XXX_DiscardUnknown()

func (*EchoTest_Request) XXX_Marshal added in v2.246.0

func (m *EchoTest_Request) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*EchoTest_Request) XXX_Merge added in v2.246.0

func (m *EchoTest_Request) XXX_Merge(src proto.Message)

func (*EchoTest_Request) XXX_Size added in v2.246.0

func (m *EchoTest_Request) XXX_Size() int

func (*EchoTest_Request) XXX_Unmarshal added in v2.246.0

func (m *EchoTest_Request) XXX_Unmarshal(b []byte) error

type Options added in v2.246.0

type Options struct {
	Logger *zap.Logger
}

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) (TestService_EchoStreamTestClient, error)
	// Use to test duplex stream.
	EchoDuplexTest(ctx context.Context, opts ...grpc.CallOption) (TestService_EchoDuplexTestClient, 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, TestService_EchoStreamTestServer) error
	// Use to test duplex stream.
	EchoDuplexTest(TestService_EchoDuplexTestServer) 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 interface {
	Send(*EchoDuplexTest_Request) error
	Recv() (*EchoDuplexTest_Reply, error)
	grpc.ClientStream
}

type TestService_EchoDuplexTestServer added in v2.246.0

type TestService_EchoDuplexTestServer interface {
	Send(*EchoDuplexTest_Reply) error
	Recv() (*EchoDuplexTest_Request, error)
	grpc.ServerStream
}

type TestService_EchoStreamTestClient added in v2.246.0

type TestService_EchoStreamTestClient interface {
	Recv() (*EchoStreamTest_Reply, error)
	grpc.ClientStream
}

type TestService_EchoStreamTestServer added in v2.246.0

type TestService_EchoStreamTestServer interface {
	Send(*EchoStreamTest_Reply) error
	grpc.ServerStream
}

type UnimplementedTestServiceServer added in v2.246.0

type UnimplementedTestServiceServer struct {
}

UnimplementedTestServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedTestServiceServer) EchoDuplexTest added in v2.246.0

func (UnimplementedTestServiceServer) EchoStreamTest added in v2.246.0

func (UnimplementedTestServiceServer) EchoTest added in v2.246.0

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.

Jump to

Keyboard shortcuts

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