datastore

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2022 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type InitFunc

type InitFunc func(engine, uri string) datastore.Datastore

InitFunc initializes a datastore instance from a uri that has been generated from a TestDatastoreBuilder

type MySQLTesterOptions added in v1.7.0

type MySQLTesterOptions struct {
	Prefix                 string
	MigrateForNewDatastore bool
}

MySQLTesterOptions allows tweaking the behaviour of the builder for the MySQL datastore

type RunningEngineForTest added in v1.7.0

type RunningEngineForTest interface {
	// NewDatabase returns the connection string to a new initialized logical database,
	// but one that is *not migrated*.
	NewDatabase(t testing.TB) string

	// NewDatastore returns a new logical datastore initialized with the
	// initFunc. For example, the sql based stores will create a new logical
	// database in the database instance, migrate it and provide the URI for it
	// to initFunc
	NewDatastore(t testing.TB, initFunc InitFunc) datastore.Datastore
}

RunningEngineForTest represents an instance of a datastore engine running with its backing database/service, expressly for testing.

func RunCRDBForTesting added in v1.7.0

func RunCRDBForTesting(t testing.TB, bridgeNetworkName string) RunningEngineForTest

RunCRDBForTesting returns a RunningEngineForTest for CRDB

func RunDatastoreEngine added in v1.7.0

func RunDatastoreEngine(t testing.TB, engine string) RunningEngineForTest

RunDatastoreEngine starts the backing database or service necessary for the given engine for testing and sets the defaults for that database or service. Note that this does *NOT* create the logical database nor call migrate; callers can do so via NewDatabase and NewDatastore respectively. Note also that the backing database or service will be shutdown automatically via the Cleanup of the testing object.

func RunDatastoreEngineWithBridge added in v1.7.0

func RunDatastoreEngineWithBridge(t testing.TB, engine string, bridgeNetworkName string) RunningEngineForTest

RunDatastoreEngineWithBridge runs a datastore engine on a specific bridge. If a bridge is specified, then the hostnames returned by the engines are those to be called from another container on the bridge.

func RunMemoryForTesting added in v1.7.0

func RunMemoryForTesting(t testing.TB) RunningEngineForTest

RunMemoryForTesting returns a RunningEngineForTest for the in-memory driver.

func RunMySQLForTesting added in v1.7.0

func RunMySQLForTesting(t testing.TB, bridgeNetworkName string) RunningEngineForTest

RunMySQLForTesting returns a RunningEngineForTest for the mysql driver backed by a MySQL instance with RunningEngineForTest options - no prefix is added, and datastore migration is run.

func RunMySQLForTestingWithOptions added in v1.7.0

func RunMySQLForTestingWithOptions(t testing.TB, options MySQLTesterOptions, bridgeNetworkName string) RunningEngineForTest

RunMySQLForTestingWithOptions returns a RunningEngineForTest for the mysql driver backed by a MySQL instance, while allowing options to be forwarded

func RunPostgresForTesting added in v1.7.0

func RunPostgresForTesting(t testing.TB, bridgeNetworkName string) RunningEngineForTest

RunPostgresForTesting returns a RunningEngineForTest for postgres

func RunSpannerForTesting added in v1.7.0

func RunSpannerForTesting(t testing.TB, bridgeNetworkName string) RunningEngineForTest

RunSpannerForTesting returns a RunningEngineForTest for spanner

type RunningEngineForTestWithEnvVars added in v1.7.0

type RunningEngineForTestWithEnvVars interface {
	RunningEngineForTest

	// ExternalEnvVars are the environment variables to be set.
	ExternalEnvVars() []string
}

RunningEngineForTestWithEnvVars represents an instance of a datastore engine running, that also requires env vars set to use from an external source (like a container).

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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