package xtest

import "github.com/ydb-platform/ydb-go-sdk/v3/internal/xtest"

Index

Functions

func SpinWaitCondition

func SpinWaitCondition(tb testing.TB, l sync.Locker, cond func() bool)

SpinWaitCondition wait while cond return true with check it in loop l can be nil - then locker use for check conditions

func SpinWaitConditionWithTimeout

func SpinWaitConditionWithTimeout(tb testing.TB, l sync.Locker, condWaitTimeout time.Duration, cond func() bool)

SpinWaitConditionWithTimeout wait while cond return true with check it in loop l can be nil - then locker use for check conditions

func TestManyTimes

func TestManyTimes(t testing.TB, test TestFunc, opts ...TestManyTimesOption)

func TestManyTimesWithName

func TestManyTimesWithName(t *testing.T, name string, test TestFunc)

func WaitChannelClosed

func WaitChannelClosed(t testing.TB, ch empty.Chan)

Types

type GrpcLogger

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

GrpcLogger use for log raw grpc messages

Usage:

	db, err := ydb.Open(context.Background(), connectionString,
     ...
		ydb.With(config.WithGrpcOptions(grpc.WithChainUnaryInterceptor(xtest.NewGrpcLogger(t).UnaryClientInterceptor))),
	)

func NewGrpcLogger

func NewGrpcLogger(t testing.TB) GrpcLogger

func (GrpcLogger) StreamClientInterceptor

func (l GrpcLogger) StreamClientInterceptor(
	ctx context.Context,
	desc *grpc.StreamDesc,
	cc *grpc.ClientConn,
	method string,
	streamer grpc.Streamer,
	opts ...grpc.CallOption,
) (grpc.ClientStream, error)

func (GrpcLogger) UnaryClientInterceptor

func (l GrpcLogger) UnaryClientInterceptor(
	ctx context.Context,
	method string,
	req, reply interface{},
	cc *grpc.ClientConn,
	invoker grpc.UnaryInvoker,
	opts ...grpc.CallOption,
) error

type TestFunc

type TestFunc func(t testing.TB)

type TestManyTimesOption

type TestManyTimesOption func(opts *testManyTimesOptions)

func StopAfter

func StopAfter(stopAfter time.Duration) TestManyTimesOption

Source Files

grpclogger.go manytimes.go waiters.go

Version
v3.37.5
Published
Sep 6, 2022
Platform
js/wasm
Imports
8 packages
Last checked
3 minutes ago

Tools for package owners.