Documentation
¶
Index ¶
- Constants
- Variables
- func AuthenticateUser(ctx context.Context, cl frontierv1beta1connect.FrontierServiceClient, ...) (string, error)
- func BootstrapGroup(ctx context.Context, cl frontierv1beta1connect.FrontierServiceClient, ...) error
- func BootstrapOrganizations(ctx context.Context, cl frontierv1beta1connect.FrontierServiceClient, ...) error
- func BootstrapProject(ctx context.Context, cl frontierv1beta1connect.FrontierServiceClient, ...) error
- func BootstrapUsers(ctx context.Context, cl frontierv1beta1connect.FrontierServiceClient, ...) error
- func ContextWithAuth(ctx context.Context, cookieStr string) context.Context
- func ContextWithHeaders(ctx context.Context, headers map[string]string) context.Context
- func CreateAdminClient(host string) (frontierv1beta1connect.AdminServiceClient, error)
- func CreateClient(host string) (frontierv1beta1connect.FrontierServiceClient, error)
- func EchoServer(network *docker.Network, pool *dockertest.Pool) (string, *dockertest.Resource, error)
- func GetFreePort() (int, error)
- func HeadersFromContext(ctx context.Context) map[string]string
- func MigrateFrontier(logger *slog.Logger, appConfig *config.Frontier) error
- func PromoteBootstrapAdmin(ctx context.Context, ad frontierv1beta1connect.AdminServiceClient, ...) error
- func SeedComputeResources(ctx context.Context, ad frontierv1beta1connect.AdminServiceClient) error
- func StartFrontier(logger *slog.Logger, appConfig *config.Frontier)
- func StartPG(network *docker.Network, pool *dockertest.Pool, dbName string) (connStringInternal, connStringExternal string, res *dockertest.Resource, ...)
- func StartSpiceDB(logger *slog.Logger, network *docker.Network, pool *dockertest.Pool, ...) (extPort string, close func() error, err error)
- func StartStripeMock(logger *slog.Logger, network *docker.Network, pool *dockertest.Pool) (extPort string, close func() error, err error)
- func StartStripeRecorder(mode recorder.Mode) func() error
- type PreStartSeeder
- type StripeClientBuilder
- type TestBench
Constants ¶
const ( OrgAdminEmail = "admin1-group1-org1@raystack.org" TestOTP = "123456" // Bootstrap superuser service-account credentials, seeded via App.Admin.Bootstrap. // Used to grant the test admin platform superuser, mirroring the production GitOps flow. // client_id is a credential UUID (serviceuser_credentials.id is a uuid column). BootstrapClientID = "11111111-2222-3333-4444-555555555555" BootstrapClientSecret = "e2e-bootstrap-secret" )
Variables ¶
var (
RuleCacheRefreshDelay = time.Minute * 2
)
Functions ¶
func AuthenticateUser ¶ added in v0.91.0
func AuthenticateUser(ctx context.Context, cl frontierv1beta1connect.FrontierServiceClient, email string) (string, error)
AuthenticateUser authenticates a user via mail OTP using the test_users config (which skips SMTP) and returns the session cookie string (e.g. "sid=<encrypted>").
func BootstrapGroup ¶
func BootstrapGroup(ctx context.Context, cl frontierv1beta1connect.FrontierServiceClient, sessionCookie string) error
func BootstrapOrganizations ¶
func BootstrapOrganizations(ctx context.Context, cl frontierv1beta1connect.FrontierServiceClient, sessionCookie string) error
func BootstrapProject ¶
func BootstrapProject(ctx context.Context, cl frontierv1beta1connect.FrontierServiceClient, sessionCookie string) error
func BootstrapUsers ¶
func BootstrapUsers(ctx context.Context, cl frontierv1beta1connect.FrontierServiceClient, sessionCookie string) error
func ContextWithAuth ¶ added in v0.91.0
ContextWithAuth returns a context that carries the session cookie for authentication.
func ContextWithHeaders ¶ added in v0.91.0
ContextWithHeaders returns a new context with the given headers. These headers will be automatically applied to ConnectRPC requests by the headerInterceptor.
func CreateAdminClient ¶
func CreateAdminClient(host string) (frontierv1beta1connect.AdminServiceClient, error)
func CreateClient ¶
func CreateClient(host string) (frontierv1beta1connect.FrontierServiceClient, error)
func EchoServer ¶
func EchoServer(network *docker.Network, pool *dockertest.Pool) (string, *dockertest.Resource, error)
func GetFreePort ¶
func HeadersFromContext ¶ added in v0.91.0
HeadersFromContext returns headers stored in the context, if any.
func PromoteBootstrapAdmin ¶ added in v0.108.0
func PromoteBootstrapAdmin(ctx context.Context, ad frontierv1beta1connect.AdminServiceClient, email string) error
PromoteBootstrapAdmin authenticates as the config-bootstrapped superuser service account (HTTP Basic client credentials) and grants the given user the platform admin (superuser) relation, the same path GitOps uses in production.
func SeedComputeResources ¶ added in v0.115.0
func SeedComputeResources(ctx context.Context, ad frontierv1beta1connect.AdminServiceClient) error
SeedComputeResources creates the custom "compute" permissions and roles the regression suites rely on, through the admin API. This replaces the removed boot-time resources_config loader: tests now seed custom resources the same way operators do, via reconcile/the admin API.
func StartPG ¶
func StartPG(network *docker.Network, pool *dockertest.Pool, dbName string) (connStringInternal, connStringExternal string, res *dockertest.Resource, err error)
func StartSpiceDB ¶
func StartStripeMock ¶ added in v0.8.0
func StartStripeRecorder ¶ added in v0.8.30
Types ¶
type PreStartSeeder ¶ added in v0.115.0
PreStartSeeder writes to the freshly migrated database before the frontier server starts. Use it to seed rows the server needs at boot, for example a billing product referenced by credit_overdraft_product, which the removed boot loader used to create. It runs after migrations and before the server starts, so the boot sequence can read what it seeds.
type StripeClientBuilder ¶ added in v0.8.30
func BuildStripeClient ¶ added in v0.8.30
func BuildStripeClient(port, name string, mode recorder.Mode) (StripeClientBuilder, func() error)
type TestBench ¶
type TestBench struct {
Pool *dockertest.Pool
Network *docker.Network
Resources []*dockertest.Resource
Client frontierv1beta1connect.FrontierServiceClient
AdminClient frontierv1beta1connect.AdminServiceClient
// contains filtered or unexported fields
}