setup

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Record = flag.Bool("record", false, "whether to run tests against cloud resources and record the interactions")

Record is true iff the tests are being run in "record" mode.

Functions

func HasDockerTestEnvironment

func HasDockerTestEnvironment() bool

HasDockerTestEnvironment returns true when either: 1) Not on Github Actions. 2) On Github's Linux environment, where Docker is available.

func NewAWSConfig

func NewAWSConfig(ctx context.Context, t *testing.T, region string) (cfg awsv2.Config, rt http.RoundTripper, cleanup func(), initState int64)

NewAWSConfig creates a new aws.Config for testing against AWS. If the test is in --record mode, the test will call out to AWS, and the results are recorded in a replay file. Otherwise, the session reads a replay file and runs the test as a replay, which never makes an outgoing HTTP call and uses fake credentials. An initState is returned for tests that need a state to have deterministic results, for example, a seed to generate random sequences.

func NewRecordReplayClient

func NewRecordReplayClient(ctx context.Context, t *testing.T, rf func(r *httpreplay.Recorder)) (c *http.Client, cleanup func(), initState int64)

NewRecordReplayClient creates a new http.Client for tests. This client's activity is being either recorded to files (when *Record is set) or replayed from files. rf is a modifier function that will be invoked with the address of the httpreplay.Recorder object used to obtain the client; this function can mutate the recorder to add service-specific header filters, for example. An initState is returned for tests that need a state to have deterministic results, for example, a seed to generate random sequences.

Types

This section is empty.

Jump to

Keyboard shortcuts

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