testutil

package
v2.413.1 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2022 License: Apache-2.0, MIT Imports: 23 Imported by: 0

Documentation

Overview

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

Index

Constants

View Source
const (
	DummyPushServerAddr = "server.test"
	PushMockBundleID    = "tech.berty.mock"
)

Variables

This section is empty.

Functions

func Close added in v2.313.0

func Close(t *testing.T, closer io.Closer)

func FilterRace added in v2.259.0

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

func FilterSpeed added in v2.130.0

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

func FilterStability added in v2.130.0

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

func FilterStabilityAndSpeed added in v2.130.0

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

func LogTree added in v2.311.2

func LogTree(t *testing.T, log string, indent int, title bool, args ...interface{})

func Logger

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

func LoggerWithRing added in v2.268.0

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

func RegisterTestServiceServer added in v2.246.0

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

func TestFilterAppMetadata added in v2.311.2

func TestFilterAppMetadata(t *testing.T, events <-chan *protocoltypes.GroupMetadataEvent) []*protocoltypes.AppMetadata

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 PushMockedDispatcher added in v2.305.0

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

func NewPushMockedDispatcher added in v2.305.0

func NewPushMockedDispatcher(bundleID string) *PushMockedDispatcher

func (*PushMockedDispatcher) BundleID added in v2.305.0

func (d *PushMockedDispatcher) BundleID() string

func (*PushMockedDispatcher) Debug added in v2.305.0

func (d *PushMockedDispatcher) Debug() string

func (*PushMockedDispatcher) Dispatch added in v2.305.0

func (d *PushMockedDispatcher) Dispatch(data []byte, receiver *protocoltypes.PushServiceReceiver) error

func (*PushMockedDispatcher) Len added in v2.305.0

func (d *PushMockedDispatcher) Len(token []byte) int

func (*PushMockedDispatcher) Shift added in v2.305.0

func (d *PushMockedDispatcher) Shift(token []byte) []byte

func (*PushMockedDispatcher) TokenType added in v2.305.0

type RacePolicy added in v2.259.0

type RacePolicy string

RacePolicy enum

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

type Speed added in v2.130.0

type Speed string

Speed level enum

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

type Stability added in v2.130.0

type Stability string

Stability level enum

const (
	Stable       Stability = "stable"
	Flappy       Stability = "flappy"
	Broken       Stability = "broken"
	AnyStability Stability = "any"
)

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

func NewTestServiceClient added in v2.246.0

func NewTestServiceClient(cc *grpc.ClientConn) 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
}

TestServiceServer is the server API for TestService service.

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 can 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

Jump to

Keyboard shortcuts

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