Documentation
¶
Overview ¶
Package testing provides support for testing the logging client.
Index ¶
- Constants
- func NewServer() (string, error)
- func PayloadEqual(a, b interface{}) bool
- func Retry(t *testing.T, f func(r *testutil.R) error) bool
- func RetryAndExpectError(t *testing.T, f func(r *testutil.R) error) bool
- func RetryIteratorNext[T any](t *testing.T, it Iterator[T]) (*T, bool)
- type Iterator
Constants ¶
const ( ValidProjectID = "PROJECT_ID" ValidOrgID = "433637338589" )
The only IDs that WriteLogEntries will accept. Important for testing Ping.
Variables ¶
This section is empty.
Functions ¶
func NewServer ¶
NewServer creates a new in-memory fake server implementing the logging service. It returns the address of the server.
func PayloadEqual ¶
func PayloadEqual(a, b interface{}) bool
PayloadEqual compares two payloads, assuming they are both proto.Messages or both strings.
func Retry ¶ added in v1.13.0
Retry is a wrapper around testutil.Retry that retries the test function on Unavailable errors, otherwise, Fatalfs.
func RetryAndExpectError ¶ added in v1.13.0
RetryAndExpectError retries the test function on Unavailable errors, otherwise passes if a different error was thrown. If no non-retryable error is returned, fails.
func RetryIteratorNext ¶ added in v1.13.0
RetryIteratorNext is a wrapper around testutil.Retry that retries the given iterator's Next function and returns the next object, retrying if a retryable error is found. If a non-retryable error is found, fail the test.