Documentation
¶
Index ¶
- type Fixture
- func (f *Fixture) ExternalURL() string
- func (f *Fixture) NewClient(t *testing.T, token string) *client.Client
- func (f *Fixture) NewSuperuser(t *testing.T) (*database.User, *client.Client)
- func (f *Fixture) NewUser(t *testing.T) (*database.User, *client.Client)
- func (f *Fixture) NewUserWithDomain(t *testing.T, domain string) (*database.User, *client.Client)
- func (f *Fixture) NewUserWithEmail(t *testing.T, emailAddr string) (*database.User, *client.Client)
- func (f *Fixture) RuntimeURL() string
- func (f *Fixture) TriggerDeployment(t *testing.T, org, project string) *database.Deployment
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Fixture ¶
type Fixture struct {
Admin *admin.Service
Server *server.Server
ServerOpts *server.Options
Audience *runtimeauth.Audience
Runtime *runtime.Runtime
RuntimeServer *runtimeserver.Server
RuntimeServerOpts *runtimeserver.Options
}
Fixture is a test fixture for an admin service and server. It wraps an admin service with a server running on a random port backed by a testcontainer Postgres database. If startRt is set to true then it also includes a runtime service and server. The service, servers and other resources will be cleaned up when the test that created the Fixture stops.
The service has several limitations compared to a production server: - Github operation are no-ops in short testing mode - Billing operations are no-ops - No configured metrics project - Does not run background jobs
func New ¶
New creates an ephemeral admin service and server for testing. See the docstring for the returned Fixture for details.
func NewWithOptionalRuntime ¶ added in v0.81.0
func (*Fixture) ExternalURL ¶
ExternalURL returns the localhost URL of the fixture's server.
func (*Fixture) NewSuperuser ¶
NewSuperuser creates a new user with superuser permission in the fixture's admin service.
func (*Fixture) NewUserWithDomain ¶
NewUserWithDomain creates a new user with a random email with the given email domain in the fixture's admin service.
func (*Fixture) NewUserWithEmail ¶
NewUserWithEmail creates a new user with the given email in the fixture's admin service.
func (*Fixture) RuntimeURL ¶ added in v0.81.0
RuntimeURL returns the URL where the embedded runtime is accessible.