Documentation
¶
Overview ¶
Package sat provides a System Acceptance Test framework that orchestrates postgres, database migrations, and services under test (SUTs).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
SUTS []SUT
Initializer SUT
Migrator SUT
PostgresServerConfig PostgresServerConfig
EnvironmentVariables map[string]string
Nats bool
Debug bool
// NatsSubjects are buffered by [SAT.NatsStore] for the lifetime of the run, so that a test
// can assert on events the RPCs triggering them do not wait for. They may contain the NATS
// wildcards `*` and `>`. Requires Nats.
NatsSubjects []string
}
Config holds all configuration needed to set up a SAT environment, including the services to test, database setup binaries, and environment variables.
type PostgresServerConfig ¶
PostgresServerConfig holds connection details for the test Postgres instance.
type SAT ¶
type SAT struct {
PostgresServer *postgrestestserver.Server
// NatsStore buffers everything published to Config.NatsSubjects, or is nil if none were
// given. It subscribes before any SUT starts, so events emitted during boot are caught too.
NatsStore *natsteststore.Nats
// contains filtered or unexported fields
}
SAT orchestrates the lifecycle of all binaries and the Postgres server required for system acceptance testing.
func New ¶
New creates a SAT instance. It starts Postgres (if a migrator is configured), runs the database initializer and migrator jobs, then starts all SUTs.
func (*SAT) Cleanup ¶
func (s *SAT) Cleanup()
Cleanup tears down everything Start brought up. It is safe to call on a partially started SAT, which is what a failing Start leaves behind.
func (*SAT) GetPostgresClient ¶
GetPostgresClient returns a started client connected to the given database on this SAT's Postgres server, as its superuser, which can reach any database the migrator created. Clients are cached per database and closed by SAT.Cleanup, so callers need not close them.