emutest

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2026 License: Apache-2.0 Imports: 14 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package emutest starts an in-process gcpemu instance for Go tests (FR-CI-009). Every port is allocated dynamically and state is ephemeral.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RequireRuntime

func RequireRuntime(t testing.TB)

RequireRuntime skips the test unless a container runtime is available (and GCPEMU_SKIP_CONTAINER_TESTS is unset), and makes a static gcpemu binary available for in-container agents.

Types

type Instance

type Instance struct {
	*instance.Instance
}

Instance is a running test emulator.

func Start

func Start(t testing.TB, svcs []string, opts ...Option) *Instance

Start launches an instance running services (plus dependencies) and stops it when the test ends. Set GCPEMU_TEST_LOG=1 to see emulator logs.

func (*Instance) Endpoint

func (i *Instance) Endpoint(name string) string

Endpoint returns the address (host:port) of a named listener, e.g. "gateway", "gcs", "pubsub".

func (*Instance) GatewayURL

func (i *Instance) GatewayURL() string

GatewayURL returns "http://<gateway>".

func (*Instance) Setenv

func (i *Instance) Setenv(t testing.TB)

Setenv sets every client environment variable the instance advertises for the duration of the test.

type Option

type Option func(*config.Config)

Option customises the configuration before start.

func WithDeterministic

func WithDeterministic() Option

WithDeterministic enables deterministic IDs and the fake clock.

func WithIAMMode

func WithIAMMode(mode string) Option

WithIAMMode sets the IAM enforcement mode.

Jump to

Keyboard shortcuts

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