Documentation
¶
Index ¶
- func AccessKey(t *testing.T, key *ecdsa.PrivateKey, claims elephantine.JWTClaims) string
- func Claims(t *testing.T, user string, scope string, units ...string) elephantine.JWTClaims
- func CloneMessage[T proto.Message](msg T) T
- func CommonTimeFields() []string
- func Context(c Cleaner) context.Contextdeprecated
- func Equal[T comparable](t TestingT, want T, got T, format string, a ...any)
- func EqualDiff[T any](t TestingT, want T, got T, format string, a ...any)
- func EqualDiffWithOptions[T any](t TestingT, want T, got T, opts cmp.Options, format string, a ...any)
- func EqualMessage(t TestingT, want proto.Message, got proto.Message, format string, a ...any)
- func EqualMessageWithOptions(t TestingT, want proto.Message, got proto.Message, opts cmp.Options, ...)
- func IsTwirpError(t TestingT, err error, code twirp.ErrorCode)
- func Must(t TestingT, err error, format string, a ...any)
- func MustNot(t TestingT, err error, format string, a ...any)
- func NewLogHandler(t Logger, level slog.Level) slog.Handler
- func NewSigningKey(t *testing.T) *ecdsa.PrivateKey
- func NotNil[T any](t TestingT, v *T, format string, a ...any)
- func Regenerate() bool
- func StandardClaims(t *testing.T, scope string, units ...string) elephantine.JWTClaims
- func TestAgainstGolden[T any](t *testing.T, regenerate bool, got T, goldenPath string, ...)
- func TestMessageAgainstGolden(t *testing.T, regenerate bool, got proto.Message, goldenPath string, ...)
- func TestMessagesAgainstGolden[T proto.Message](t *testing.T, regenerate bool, gotSlice []T, goldenPath string, ...)
- type Cleaner
- type GoldenHelper
- type GoldenHelperForAny
- type IgnoreField
- type IgnoreTimestamps
- type LogHandler
- func (h *LogHandler) Enabled(ctx context.Context, level slog.Level) bool
- func (h *LogHandler) Handle(ctx context.Context, r slog.Record) error
- func (h *LogHandler) WithAttrs(attrs []slog.Attr) slog.Handler
- func (h *LogHandler) WithGroup(name string) slog.Handler
- func (h *LogHandler) Write(data []byte) (int, error)
- type Logger
- type TestingT
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AccessKey ¶ added in v0.20.3
func AccessKey( t *testing.T, key *ecdsa.PrivateKey, claims elephantine.JWTClaims, ) string
AccessKey creates a signed access key from the signing key and claims.
func CloneMessage ¶
CloneMessage allows for type safe cloning of protobuf messages.
func CommonTimeFields ¶ added in v0.17.10
func CommonTimeFields() []string
func EqualDiff ¶ added in v0.3.0
EqualDiff runs a cmp.Diff to do a deep equal check with readable diff output.
func EqualDiffWithOptions ¶ added in v0.21.1
func EqualDiffWithOptions[T any]( t TestingT, want T, got T, opts cmp.Options, format string, a ...any, )
EqualMessage runs a cmp.Diff with protobuf-specific options.
func EqualMessage ¶
EqualMessage runs a cmp.Diff with protobuf-specific options.
func EqualMessageWithOptions ¶ added in v0.17.2
func EqualMessageWithOptions(t TestingT, want proto.Message, got proto.Message, opts cmp.Options, format string, a ...any, )
EqualMessage runs a cmp.Diff with protobuf-specific options.
func NewSigningKey ¶ added in v0.20.3
func NewSigningKey(t *testing.T) *ecdsa.PrivateKey
NewSigningKey creates a signing key for use with a elephantine.NewStaticAuthInfoParser.
func Regenerate ¶ added in v0.23.5
func Regenerate() bool
Regenerate test fixtures will return true if the environment variable REGENERATE is set to true.
func StandardClaims ¶ added in v0.20.3
StandardClaims is a helper function that creates standard claims for a test.
func TestAgainstGolden ¶ added in v0.21.1
func TestAgainstGolden[T any]( t *testing.T, regenerate bool, got T, goldenPath string, helpers ...GoldenHelper, )
TestAgainstGolden compares a result against the contents of the file at the goldenPath. Run with regenerate set to true to create or update the file.
func TestMessageAgainstGolden ¶ added in v0.17.2
func TestMessageAgainstGolden( t *testing.T, regenerate bool, got proto.Message, goldenPath string, helpers ...GoldenHelper, )
TestMessageAgainstGolden compares a protobuf message against the contents of the file at the goldenPath. Run with regenerate set to true to create or update the file.
func TestMessagesAgainstGolden ¶ added in v0.22.1
func TestMessagesAgainstGolden[T proto.Message]( t *testing.T, regenerate bool, gotSlice []T, goldenPath string, helpers ...GoldenHelper, )
TestMessagesAgainstGolden compares a slice of protobuf messages against the contents of the file at the goldenPath. Run with regenerate set to true to create or update the file.
Types ¶
type GoldenHelper ¶ added in v0.17.10
type GoldenHelperForAny ¶ added in v0.21.1
type IgnoreField ¶ added in v0.20.1
func (IgnoreField[T]) CmpOpts ¶ added in v0.20.1
func (fi IgnoreField[T]) CmpOpts() cmp.Options
CmpOpts implements GoldenHelper.
func (IgnoreField[T]) JSONTransform ¶ added in v0.20.1
func (fi IgnoreField[T]) JSONTransform(value map[string]any) error
JSONTransform implements GoldenHelper.
type IgnoreTimestamps ¶ added in v0.17.10
func (IgnoreTimestamps) CmpOpts ¶ added in v0.17.10
func (it IgnoreTimestamps) CmpOpts() cmp.Options
func (IgnoreTimestamps) JSONTransform ¶ added in v0.17.10
func (it IgnoreTimestamps) JSONTransform(value map[string]any) error
type LogHandler ¶
type LogHandler struct {
// contains filtered or unexported fields
}