Documentation ¶
Overview ¶
Package emulators contains functions to start and stop emulators, and utilities to work with the various *_EMULATOR_HOST environment variables.
Unless otherwise specified, all functions in this package assume that there will be at most one instance of each emulator running at any given time.
Index ¶
- Constants
- Variables
- func ForceStopAllEmulators() error
- func GetEmulatorHostEnvVar(emulator Emulator) string
- func GetEmulatorHostEnvVarName(emulator Emulator) string
- func RequireEmulator(t sktest.TestingT, emulator Emulator, fn EmulatorLauncherFn)
- func StartEmulatorCmd(cmd *exec.Cmd) error
- func StopAllEmulators() error
- type Emulator
- type EmulatorLauncherFn
Constants ¶
const ( // BigTable represents a Google Cloud BigTable emulator. BigTable = Emulator("BigTable") BigTableEnvVar = "BIGTABLE_EMULATOR_HOST" BigTablePort = 8892 // CockroachDB represents a test-only CockroachDB instance. CockroachDB = Emulator("CockroachDB") CockroachDBEnvVar = "COCKROACHDB_EMULATOR_HOST" CockroachDBPort = 8895 // Datastore represents a Google Cloud Datastore emulator. Datastore = Emulator("Datastore") DatastoreEnvVar = "DATASTORE_EMULATOR_HOST" DataStorePort = 8891 // Firestore represents a Google Cloud Firestore emulator. Firestore = Emulator("Firestore") FirestoreEnvVar = "FIRESTORE_EMULATOR_HOST" FirestorePort = 8894 // PubSub represents a Google Cloud PubSub emulator. PubSub = Emulator("PubSub") PubSubEnvVar = "PUBSUB_EMULATOR_HOST" PubSubPort = 8893 )
Variables ¶
var AllEmulators = []Emulator{BigTable, CockroachDB, Datastore, Firestore, PubSub}
Functions ¶
func ForceStopAllEmulators ¶
func ForceStopAllEmulators() error
ForceStopAllEmulators immediately terminates all known emulators with SIGKILL.
func GetEmulatorHostEnvVar ¶
GetEmulatorHostEnvVar returns the contents of the *_EMULATOR_HOST environment variable corresponding to the given emulator, or the empty string if the environment variable is unset.
func GetEmulatorHostEnvVarName ¶
GetEmulatorHostEnvVarName returns the name of the *_EMULATOR_HOST environment variable corresponding to the given emulator.
func RequireEmulator ¶
func RequireEmulator(t sktest.TestingT, emulator Emulator, fn EmulatorLauncherFn)
RequireEmulator fails the test when running outside of RBE if the corresponding *_EMULATOR_HOST environment variable wasn't set, or starts a new emulator instance under RBE if necessary. This should not be called by unit tests directly, but rather by the subpackages of this module.
func StartEmulatorCmd ¶
StartEmulatorCmd performs some shared-setup to starting emulators. It should not be called by anything other than subpackages of this package.
func StopAllEmulators ¶
func StopAllEmulators() error
StopAllEmulators gracefully terminates all known emulators.
Types ¶
type Emulator ¶
type Emulator string
Emulator represents a Google Cloud emulator, a test-only CockroachDB server, etc.