awstest

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoCredentials = errors.New("no credentials")

ErrNoCredentials stands in for anything that stops a credential being read.

Functions

func Ctx

func Ctx() context.Context

Ctx is the background context, named for what every call needs one for.

func Ref

func Ref(kind resources.Kind, name string, values map[string]string) resources.Ref

Ref builds the pair a deployment writes, including the topology, saying which key holds a resource, and the values recorded under it.

func SimpleRef

func SimpleRef(kind resources.Kind, name, id string) resources.Ref

SimpleRef is the ordinary case: one identifier, under the resource's own key.

Types

type Secrets

type Secrets struct {
	Asked  string
	Value  string
	Absent bool
	Err    error
}

Secrets stands in for Secrets Manager, which two resource kinds read a credential through.

type Target

type Target struct {
	// Endpoint the SDK is pointed at. Empty against an account, so that the SDK
	// resolves each service's own.
	Endpoint string

	// Region every client is built for, and the one a signature is scoped to.
	Region string

	// Emulator says the endpoint is a stand-in, which is what makes test
	// credentials safe and path-style addressing necessary.
	Emulator bool

	// Prefix goes in front of every resource name a suite creates, so that two
	// runs sharing an account do not share a table.
	Prefix string
}

Target is the AWS an integration suite runs against, an emulator on the machine running the tests by default, or a real account when one is configured.

func AWS

func AWS(t *testing.T) (Target, aws.Config)

AWS is what a suite's SetupSuite calls including where this run points, and a configuration for creating the infrastructure a deployment would have created.

func TargetFromEnv

func TargetFromEnv() Target

TargetFromEnv reads where this run points. Configuring nothing is the ordinary case and uses the emulator that the compose file brings up.

func (Target) Config

func (target Target) Config(t *testing.T) aws.Config

Config points the process at the target and returns a configuration built for it.

The environment is set as well as the configuration returned, because a provider builds its own clients from the ambient configuration: setting it here is what makes a suite exercise that path rather than one built for the test.

func (Target) Name

func (target Target) Name(base string) string

Name is what a suite calls a resource it creates. Against an emulator that is usually the base name; against an account a prefix keeps concurrent runs, and the people sharing the account, out of each other's way.

func (Target) Reachable

func (target Target) Reachable(t *testing.T, probe func(context.Context) error)

Reachable skips a suite when the target is not there, so that a run without it reports what is missing rather than a wall of failures.

func (Target) String

func (target Target) String() string

Jump to

Keyboard shortcuts

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