Documentation

Overview

    Package testutil contains testing helpers (logging, slow skipping).

    Index

    Constants

    This section is empty.

    Variables

    This section is empty.

    Functions

    func FilterRace

    func FilterRace(t *testing.T, race RacePolicy)

    func FilterSpeed

    func FilterSpeed(t *testing.T, speed Speed)

    func FilterStability

    func FilterStability(t *testing.T, stability Stability)

    func FilterStabilityAndSpeed

    func FilterStabilityAndSpeed(t *testing.T, stability Stability, speed Speed)

    func Logger

    func Logger(t testing.TB) (*zap.Logger, func())

    func LoggerWithRing

    func LoggerWithRing(t testing.TB) (*zap.Logger, *zapring.Core, func())

    func RegisterTestServiceServer

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

    func TestingNewServiceClient

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

    Types

    type EchoDuplexTest

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

    func (*EchoDuplexTest) Descriptor

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

    func (*EchoDuplexTest) ProtoMessage

    func (*EchoDuplexTest) ProtoMessage()

    func (*EchoDuplexTest) Reset

    func (m *EchoDuplexTest) Reset()

    func (*EchoDuplexTest) String

    func (m *EchoDuplexTest) String() string

    func (*EchoDuplexTest) XXX_DiscardUnknown

    func (m *EchoDuplexTest) XXX_DiscardUnknown()

    func (*EchoDuplexTest) XXX_Marshal

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

    func (*EchoDuplexTest) XXX_Merge

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

    func (*EchoDuplexTest) XXX_Size

    func (m *EchoDuplexTest) XXX_Size() int

    func (*EchoDuplexTest) XXX_Unmarshal

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

    type EchoDuplexTest_Reply

    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

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

    func (*EchoDuplexTest_Reply) GetEcho

    func (m *EchoDuplexTest_Reply) GetEcho() string

    func (*EchoDuplexTest_Reply) ProtoMessage

    func (*EchoDuplexTest_Reply) ProtoMessage()

    func (*EchoDuplexTest_Reply) Reset

    func (m *EchoDuplexTest_Reply) Reset()

    func (*EchoDuplexTest_Reply) String

    func (m *EchoDuplexTest_Reply) String() string

    func (*EchoDuplexTest_Reply) XXX_DiscardUnknown

    func (m *EchoDuplexTest_Reply) XXX_DiscardUnknown()

    func (*EchoDuplexTest_Reply) XXX_Marshal

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

    func (*EchoDuplexTest_Reply) XXX_Merge

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

    func (*EchoDuplexTest_Reply) XXX_Size

    func (m *EchoDuplexTest_Reply) XXX_Size() int

    func (*EchoDuplexTest_Reply) XXX_Unmarshal

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

    type EchoDuplexTest_Request

    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

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

    func (*EchoDuplexTest_Request) GetEcho

    func (m *EchoDuplexTest_Request) GetEcho() string

    func (*EchoDuplexTest_Request) GetTriggerError

    func (m *EchoDuplexTest_Request) GetTriggerError() bool

    func (*EchoDuplexTest_Request) ProtoMessage

    func (*EchoDuplexTest_Request) ProtoMessage()

    func (*EchoDuplexTest_Request) Reset

    func (m *EchoDuplexTest_Request) Reset()

    func (*EchoDuplexTest_Request) String

    func (m *EchoDuplexTest_Request) String() string

    func (*EchoDuplexTest_Request) XXX_DiscardUnknown

    func (m *EchoDuplexTest_Request) XXX_DiscardUnknown()

    func (*EchoDuplexTest_Request) XXX_Marshal

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

    func (*EchoDuplexTest_Request) XXX_Merge

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

    func (*EchoDuplexTest_Request) XXX_Size

    func (m *EchoDuplexTest_Request) XXX_Size() int

    func (*EchoDuplexTest_Request) XXX_Unmarshal

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

    type EchoStreamTest

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

    func (*EchoStreamTest) Descriptor

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

    func (*EchoStreamTest) ProtoMessage

    func (*EchoStreamTest) ProtoMessage()

    func (*EchoStreamTest) Reset

    func (m *EchoStreamTest) Reset()

    func (*EchoStreamTest) String

    func (m *EchoStreamTest) String() string

    func (*EchoStreamTest) XXX_DiscardUnknown

    func (m *EchoStreamTest) XXX_DiscardUnknown()

    func (*EchoStreamTest) XXX_Marshal

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

    func (*EchoStreamTest) XXX_Merge

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

    func (*EchoStreamTest) XXX_Size

    func (m *EchoStreamTest) XXX_Size() int

    func (*EchoStreamTest) XXX_Unmarshal

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

    type EchoStreamTest_Reply

    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

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

    func (*EchoStreamTest_Reply) GetEcho

    func (m *EchoStreamTest_Reply) GetEcho() string

    func (*EchoStreamTest_Reply) ProtoMessage

    func (*EchoStreamTest_Reply) ProtoMessage()

    func (*EchoStreamTest_Reply) Reset

    func (m *EchoStreamTest_Reply) Reset()

    func (*EchoStreamTest_Reply) String

    func (m *EchoStreamTest_Reply) String() string

    func (*EchoStreamTest_Reply) XXX_DiscardUnknown

    func (m *EchoStreamTest_Reply) XXX_DiscardUnknown()

    func (*EchoStreamTest_Reply) XXX_Marshal

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

    func (*EchoStreamTest_Reply) XXX_Merge

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

    func (*EchoStreamTest_Reply) XXX_Size

    func (m *EchoStreamTest_Reply) XXX_Size() int

    func (*EchoStreamTest_Reply) XXX_Unmarshal

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

    type EchoStreamTest_Request

    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

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

    func (*EchoStreamTest_Request) GetDelay

    func (m *EchoStreamTest_Request) GetDelay() uint64

    func (*EchoStreamTest_Request) GetEcho

    func (m *EchoStreamTest_Request) GetEcho() string

    func (*EchoStreamTest_Request) GetTriggerError

    func (m *EchoStreamTest_Request) GetTriggerError() bool

    func (*EchoStreamTest_Request) ProtoMessage

    func (*EchoStreamTest_Request) ProtoMessage()

    func (*EchoStreamTest_Request) Reset

    func (m *EchoStreamTest_Request) Reset()

    func (*EchoStreamTest_Request) String

    func (m *EchoStreamTest_Request) String() string

    func (*EchoStreamTest_Request) XXX_DiscardUnknown

    func (m *EchoStreamTest_Request) XXX_DiscardUnknown()

    func (*EchoStreamTest_Request) XXX_Marshal

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

    func (*EchoStreamTest_Request) XXX_Merge

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

    func (*EchoStreamTest_Request) XXX_Size

    func (m *EchoStreamTest_Request) XXX_Size() int

    func (*EchoStreamTest_Request) XXX_Unmarshal

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

    type EchoTest

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

    func (*EchoTest) Descriptor

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

    func (*EchoTest) ProtoMessage

    func (*EchoTest) ProtoMessage()

    func (*EchoTest) Reset

    func (m *EchoTest) Reset()

    func (*EchoTest) String

    func (m *EchoTest) String() string

    func (*EchoTest) XXX_DiscardUnknown

    func (m *EchoTest) XXX_DiscardUnknown()

    func (*EchoTest) XXX_Marshal

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

    func (*EchoTest) XXX_Merge

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

    func (*EchoTest) XXX_Size

    func (m *EchoTest) XXX_Size() int

    func (*EchoTest) XXX_Unmarshal

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

    type EchoTest_Reply

    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

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

    func (*EchoTest_Reply) GetEcho

    func (m *EchoTest_Reply) GetEcho() string

    func (*EchoTest_Reply) ProtoMessage

    func (*EchoTest_Reply) ProtoMessage()

    func (*EchoTest_Reply) Reset

    func (m *EchoTest_Reply) Reset()

    func (*EchoTest_Reply) String

    func (m *EchoTest_Reply) String() string

    func (*EchoTest_Reply) XXX_DiscardUnknown

    func (m *EchoTest_Reply) XXX_DiscardUnknown()

    func (*EchoTest_Reply) XXX_Marshal

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

    func (*EchoTest_Reply) XXX_Merge

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

    func (*EchoTest_Reply) XXX_Size

    func (m *EchoTest_Reply) XXX_Size() int

    func (*EchoTest_Reply) XXX_Unmarshal

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

    type EchoTest_Request

    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

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

    func (*EchoTest_Request) GetDelay

    func (m *EchoTest_Request) GetDelay() uint64

    func (*EchoTest_Request) GetEcho

    func (m *EchoTest_Request) GetEcho() string

    func (*EchoTest_Request) GetTriggerError

    func (m *EchoTest_Request) GetTriggerError() bool

    func (*EchoTest_Request) ProtoMessage

    func (*EchoTest_Request) ProtoMessage()

    func (*EchoTest_Request) Reset

    func (m *EchoTest_Request) Reset()

    func (*EchoTest_Request) String

    func (m *EchoTest_Request) String() string

    func (*EchoTest_Request) XXX_DiscardUnknown

    func (m *EchoTest_Request) XXX_DiscardUnknown()

    func (*EchoTest_Request) XXX_Marshal

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

    func (*EchoTest_Request) XXX_Merge

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

    func (*EchoTest_Request) XXX_Size

    func (m *EchoTest_Request) XXX_Size() int

    func (*EchoTest_Request) XXX_Unmarshal

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

    type Options

    type Options struct {
    	Logger *zap.Logger
    }

    type RacePolicy

    type RacePolicy string

      RacePolicy enum

      const (
      	SkipIfRace RacePolicy = "skip-if-race"
      	RunIfRace  RacePolicy = "run-if-race"
      )

      type Speed

      type Speed string

        Speed level enum

        const (
        	Fast     Speed = "fast"
        	Slow     Speed = "slow"
        	AnySpeed Speed = "any"
        )

        type Stability

        type Stability string

          Stability level enum

          const (
          	Stable       Stability = "stable"
          	Unstable     Stability = "unstable"
          	Broken       Stability = "broken"
          	AnyStability Stability = "any"
          )

          type TestServiceClient

          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://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

            func NewTestServiceClient

            func NewTestServiceClient(cc *grpc.ClientConn) TestServiceClient

            type TestServiceServer

            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
            }

              TestServiceServer is the server API for TestService service.

              func NewService

              func NewService(opts *Options) TestServiceServer

              type TestService_EchoDuplexTestClient

              type TestService_EchoDuplexTestClient interface {
              	Send(*EchoDuplexTest_Request) error
              	Recv() (*EchoDuplexTest_Reply, error)
              	grpc.ClientStream
              }

              type TestService_EchoDuplexTestServer

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

              type TestService_EchoStreamTestClient

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

              type TestService_EchoStreamTestServer

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

              type UnimplementedTestServiceServer

              type UnimplementedTestServiceServer struct{}

                UnimplementedTestServiceServer can be embedded to have forward compatible implementations.

                func (*UnimplementedTestServiceServer) EchoDuplexTest

                func (*UnimplementedTestServiceServer) EchoStreamTest

                func (*UnimplementedTestServiceServer) EchoTest