emulators

package
v0.0.0-...-375621a Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2024 License: BSD-3-Clause Imports: 11 Imported by: 0

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

View Source
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

Functions

func ForceStopAllEmulators

func ForceStopAllEmulators() error

ForceStopAllEmulators immediately terminates all known emulators with SIGKILL.

func GetEmulatorHostEnvVar

func GetEmulatorHostEnvVar(emulator Emulator) string

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

func GetEmulatorHostEnvVarName(emulator Emulator) string

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

func StartEmulatorCmd(cmd *exec.Cmd) error

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.

type EmulatorLauncherFn

type EmulatorLauncherFn func() (bool, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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