Documentation
¶
Overview ¶
Package testutil implements various utilities to reduce boilerplate in unit tests a la testify.
Index ¶
- func AreProtoEqual[T proto.Message](expected, found T, message string, args ...any) error
- func AreProtoSlicesEqual[T proto.Message](expected, found []T, cmp func(a, b T) int, message string, args ...any) error
- func GoLeakIgnores() []goleak.Option
- func InternalConnString(dbConnString, driverName string) (string, error)
- func InternalConnectionEnvVars(dbConnURI, driverName string) (map[string]string, error)
- func RequireEqualEmptyNil(t *testing.T, expected, actual any, msgAndArgs ...any)
- func RequireProtoEqual[T proto.Message](t testing.TB, expected, found T, message string, args ...any)
- func RequireProtoSlicesEqual[T proto.Message](t testing.TB, expected, found []T, cmp func(a, b T) int, message string, ...)
- func RequireWithin(t *testing.T, runner func(t *testing.T), timeout time.Duration)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AreProtoEqual ¶ added in v1.15.0
AreProtoEqual returns whether the expected and required protocol buffer messages are equal, via proto.Equal. If the messages are not equal, returns an error.
func AreProtoSlicesEqual ¶ added in v1.15.0
func AreProtoSlicesEqual[T proto.Message](expected, found []T, cmp func(a, b T) int, message string, args ...any) error
AreProtoSlicesEqual returns whether the slices of protocol buffers are equal via protocol buffer comparison.
func GoLeakIgnores ¶ added in v1.35.1
func InternalConnString ¶ added in v1.55.0
func InternalConnectionEnvVars ¶ added in v1.55.0
InternalConnectionEnvVars takes a db connection URI and a database driver name and returns the environment variables necessary for a SpiceDB pod to talk to a container running that datastore over the internal docker network. this is necessary because otherwise the db URI makes the assumption that you're connecting on the host.
func RequireEqualEmptyNil ¶
RequireEqualEmptyNil is a version of require.Equal, but considers nil slices/maps to be equal to empty slices/maps.
func RequireProtoEqual ¶ added in v1.15.0
func RequireProtoEqual[T proto.Message](t testing.TB, expected, found T, message string, args ...any)
RequireProtoEqual ensures that the expected and required protocol buffer messages are equal, via proto.Equal.
func RequireProtoSlicesEqual ¶ added in v1.15.0
func RequireProtoSlicesEqual[T proto.Message](t testing.TB, expected, found []T, cmp func(a, b T) int, message string, args ...any)
RequireProtoSlicesEqual ensures that the expected slices of protocol buffers are equal. The sort function is used to sort the messages before comparison.
Types ¶
This section is empty.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package sdbtestcontainer provides a testcontainers module for SpiceDB.
|
Package sdbtestcontainer provides a testcontainers module for SpiceDB. |