testadmin

package
v0.81.0 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2026 License: Apache-2.0 Imports: 43 Imported by: 0

Documentation

Index

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

func New(t *testing.T) *Fixture

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 NewWithOptionalRuntime(t *testing.T, startRt bool) *Fixture

func (*Fixture) ExternalURL

func (f *Fixture) ExternalURL() string

ExternalURL returns the localhost URL of the fixture's server.

func (*Fixture) NewClient

func (f *Fixture) NewClient(t *testing.T, token string) *client.Client

NewClient creates a new client for the fixture's server.

func (*Fixture) NewSuperuser

func (f *Fixture) NewSuperuser(t *testing.T) (*database.User, *client.Client)

NewSuperuser creates a new user with superuser permission in the fixture's admin service.

func (*Fixture) NewUser

func (f *Fixture) NewUser(t *testing.T) (*database.User, *client.Client)

NewUser creates a new user in the fixture's admin service.

func (*Fixture) NewUserWithDomain

func (f *Fixture) NewUserWithDomain(t *testing.T, domain string) (*database.User, *client.Client)

NewUserWithDomain creates a new user with a random email with the given email domain in the fixture's admin service.

func (*Fixture) NewUserWithEmail

func (f *Fixture) NewUserWithEmail(t *testing.T, emailAddr string) (*database.User, *client.Client)

NewUserWithEmail creates a new user with the given email in the fixture's admin service.

func (*Fixture) RuntimeURL added in v0.81.0

func (f *Fixture) RuntimeURL() string

RuntimeURL returns the URL where the embedded runtime is accessible.

func (*Fixture) TriggerDeployment added in v0.81.0

func (f *Fixture) TriggerDeployment(t *testing.T, org, project string) *database.Deployment

Jump to

Keyboard shortcuts

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