package testing
import "cloud.google.com/go/logging/internal/testing"
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" = "serviceAccount:cloud-logs@system.gserviceaccount.com" )
The only IDs that WriteLogEntries will accept. Important for testing Ping.
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 ¶
Retry is a wrapper around testutil.Retry that retries the test function on Unavailable errors, otherwise, Fatalfs.
func RetryAndExpectError ¶
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 ¶
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.
Types ¶
type Iterator ¶
Iterator is a wrapper interface type for iterators in the logadmin library that have a Next function that gets the next item/error, or returns nil/iterator.Done if the object has no next item.
Source Files ¶
equal.go fake.go retry.go
- Version
- v1.13.0 (latest)
- Published
- Jan 2, 2025
- Platform
- linux/amd64
- Imports
- 19 packages
- Last checked
- 1 day ago –
Tools for package owners.