xtest

package
v3.80.13 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2024 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllowByFlag

func AllowByFlag(t testing.TB, flag string)

func CallMethod

func CallMethod(object any, name string, args ...any) []any

func Context

func Context(t testing.TB) context.Context

func ContextWithCommonTimeout

func ContextWithCommonTimeout(ctx context.Context, t testing.TB) context.Context

func CurrentFileLine

func CurrentFileLine() string

func FastClock

func FastClock(t testing.TB) clockwork.FakeClock

FastClock returns fake clock with very fast time speed advanced until end of test the clock stops advance at end of test

func GrpcMockTopicConnString

func GrpcMockTopicConnString(e fixenv.Env, topicServiceImpl Ydb_Topic_V1.TopicServiceServer) string

func Must

func Must[R any](res R, err error) R

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 SpinWaitProgress

func SpinWaitProgress(tb testing.TB, progress func() (progressValue interface{}, finished bool))

SpinWaitProgress failed if result of progress func no changes without timeout

func SpinWaitProgressWithTimeout

func SpinWaitProgressWithTimeout(
	tb testing.TB,
	timeout time.Duration,
	progress func() (progressValue interface{}, finished bool),
)

func TestManyTimes

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

func TestManyTimesWithName

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

func ToJSON

func ToJSON(v interface{}) string

func WaitChannelClosed

func WaitChannelClosed(t testing.TB, ch <-chan struct{})

func WaitChannelClosedWithTimeout

func WaitChannelClosedWithTimeout(t testing.TB, ch <-chan struct{}, timeout time.Duration)

func WaitGroup

func WaitGroup(tb testing.TB, wg *sync.WaitGroup)

func WaitGroupWithTimeout

func WaitGroupWithTimeout(tb testing.TB, wg *sync.WaitGroup, timeout time.Duration)

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.Change(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 SyncedTest

type SyncedTest struct {
	*testing.T
	// contains filtered or unexported fields
}

func MakeSyncedTest

func MakeSyncedTest(t *testing.T) *SyncedTest

func (*SyncedTest) Cleanup

func (s *SyncedTest) Cleanup(f func())

func (*SyncedTest) Error

func (s *SyncedTest) Error(args ...interface{})

func (*SyncedTest) Errorf

func (s *SyncedTest) Errorf(format string, args ...interface{})

func (*SyncedTest) Fail

func (s *SyncedTest) Fail()

func (*SyncedTest) FailNow

func (s *SyncedTest) FailNow()

func (*SyncedTest) Failed

func (s *SyncedTest) Failed() bool

func (*SyncedTest) Fatal

func (s *SyncedTest) Fatal(args ...interface{})

func (*SyncedTest) Fatalf

func (s *SyncedTest) Fatalf(format string, args ...interface{})

func (*SyncedTest) Log

func (s *SyncedTest) Log(args ...interface{})

func (*SyncedTest) Logf

func (s *SyncedTest) Logf(format string, args ...interface{})

func (*SyncedTest) Name

func (s *SyncedTest) Name() string

func (*SyncedTest) Run

func (s *SyncedTest) Run(name string, f func(t *testing.T)) bool

func (*SyncedTest) RunSynced

func (s *SyncedTest) RunSynced(name string, f func(t *SyncedTest)) bool

func (*SyncedTest) Setenv

func (s *SyncedTest) Setenv(key, value string)

func (*SyncedTest) Skip

func (s *SyncedTest) Skip(args ...interface{})

func (*SyncedTest) SkipNow

func (s *SyncedTest) SkipNow()

func (*SyncedTest) Skipf

func (s *SyncedTest) Skipf(format string, args ...interface{})

func (*SyncedTest) Skipped

func (s *SyncedTest) Skipped() bool

func (*SyncedTest) TempDir

func (s *SyncedTest) TempDir() string

type TestFunc

type TestFunc func(t testing.TB)

type TestManyTimesOption

type TestManyTimesOption func(opts *testManyTimesOptions)

func StopAfter

func StopAfter(stopAfter time.Duration) TestManyTimesOption

Jump to

Keyboard shortcuts

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