testutil

package
v0.0.0-...-a70aae3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 14, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package testutil holds helper functions for testing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IntegrationTestContext

func IntegrationTestContext(tb testing.TB) context.Context

IntegrationTestContext returns a context for testing code that talks to Spanner and uses tsmon. Skips the test if integration tests are not enabled.

Tests that use Spanner must not call t.Parallel().

func MustApply

func MustApply(ctx context.Context, t testing.TB, ms ...*spanner.Mutation) time.Time

MustApply applies the mutations to the spanner client in the context. Asserts that application succeeds. Returns the commit timestamp.

func SpannerTestContext

func SpannerTestContext(tb testing.TB) context.Context

SpannerTestContext returns a context for testing code that talks to Spanner. Skips the test if integration tests are not enabled.

Tests that use Spanner must not call t.Parallel().

func SpannerTestMain

func SpannerTestMain(m *testing.M)

SpannerTestMain is a test main function for packages that have tests that talk to spanner. It creates/destroys a temporary spanner database before/after running tests.

This function never returns. Instead it calls os.Exit with the value returned by m.Run().

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL