Documentation
¶
Index ¶
- func ResourceID(prefix string) string
- type Dependency
- type Isolator
- type Options
- type SettingsProvider
- type Suite
- func (s *Suite) Addr() string
- func (s *Suite) Config() app.Module
- func (s *Suite) Conn() *grpc.ClientConn
- func (s *Suite) DialWithToken(token string) (*grpc.ClientConn, error)
- func (s *Suite) Injector() do.Injector
- func (s *Suite) Isolated(ctx context.Context, overrides map[string]any) (*Suite, error)
- func (s *Suite) Rebooted(ctx context.Context, overrides map[string]any) (*Suite, error)
- func (s *Suite) Stop() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ResourceID ¶
ResourceID returns a resource ID under the prefix that no other spec carries, so the specs share one database without sharing a resource.
Types ¶
type Dependency ¶
type Dependency interface {
Start(ctx context.Context, injector do.Injector) error
Stop(ctx context.Context) error
}
Dependency is infrastructure the service under test needs. Start brings it up and puts what specs arrange with, such as a database connection, into the injector.
type Options ¶
type Options struct {
// Modules has the shape of a service's own module list constructor.
Modules func(conf app.Module) []app.Module
// Dependencies come up before the service and merge their settings into
// its config.
Dependencies []Dependency
// Settings has the shape of the service's config file. It overrides what
// Boot and the dependencies set.
Settings map[string]any
}
type SettingsProvider ¶
SettingsProvider yields the settings a started dependency hands the service.
type Suite ¶
type Suite struct {
// contains filtered or unexported fields
}
func Boot ¶
Boot starts the dependencies, then runs a service in this process and waits for its health service to answer. Specs reach it over a real socket.
func (*Suite) Conn ¶
func (s *Suite) Conn() *grpc.ClientConn
func (*Suite) DialWithToken ¶ added in v0.5.0
func (s *Suite) DialWithToken(token string) (*grpc.ClientConn, error)
DialWithToken opens a connection that sends the token as `authorization: Bearer <token>` on every call. The caller closes it.
func (*Suite) Injector ¶
Injector holds what the dependencies provided for arranging state. The service's own injector stays out of reach.