Documentation ¶
Index ¶
- func CompareUnorderedStringSlice(a []string, b []string) bool
- func DatumEqual(t testing.TB, expected, actual types.Datum, msgAndArgs ...any)
- func HandleEqual(t testing.TB, expected, actual kv.Handle, msgAndArgs ...any)
- func MaskSortHandles(handles []int64, shardBitsCount int, fieldType byte) []int64
- func MustNewCommonHandle(t *testing.T, values ...any) kv.Handle
- func RandStringRunes(n int) string
- type LogHook
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CompareUnorderedStringSlice ¶
CompareUnorderedStringSlice compare two string slices. If a and b is exactly the same except the order, it returns true. In otherwise return false.
func DatumEqual ¶
DatumEqual verifies that the actual value is equal to the expected value. For string datum, they are compared by the binary collation.
func HandleEqual ¶
HandleEqual verifies that the actual handle is equal to the expected handle.
func MaskSortHandles ¶
MaskSortHandles sorts the handles by lowest (fieldTypeBits - 1 - shardBitsCount) bits.
func MustNewCommonHandle ¶
MustNewCommonHandle create a common handle with given values.
func RandStringRunes ¶
RandStringRunes generate random string of length n.
Types ¶
type LogHook ¶
LogHook captures logs, mainly for testing
func WithLogHook ¶
func WithLogHook(ctx context.Context, t *testing.T, msgFilter string) (newCtx context.Context, hook *LogHook)
WithLogHook is a helper function to use with LogHook. It returns a context whose logger is replaced with the hook.
func (*LogHook) Check ¶
func (h *LogHook) Check(entry zapcore.Entry, ce *zapcore.CheckedEntry) *zapcore.CheckedEntry
Check implements the string filter
func (*LogHook) CheckLogCount ¶
CheckLogCount is a helper function to assert the number of logs captured