apptest

package
v0.22.1 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2023 License: AGPL-3.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(t *testing.T, factory DeploymentFactory)

Run runs the entire workspace app test suite against deployments minted by the provided factory.

Types

type App

type App struct {
	Username      string
	WorkspaceName string
	// AgentName is optional, except for when proxying to a port. AgentName is
	// always ignored when making a path app URL.
	//
	// Set WorkspaceName to `workspace.agent` if you want to generate a path app
	// URL with an agent name.
	AgentName     string
	AppSlugOrPort string

	Query string
}

App is similar to httpapi.ApplicationURL but with a Query field.

type AppDetails

type AppDetails struct {
	*Deployment

	Me codersdk.User

	Workspace *codersdk.Workspace
	Agent     *codersdk.WorkspaceAgent
	AppPort   uint16

	FakeApp          App
	OwnerApp         App
	AuthenticatedApp App
	PublicApp        App
	PortApp          App
}

AppDetails are the full test details returned from setupProxyTestWithFactory.

func (*AppDetails) PathAppURL

func (d *AppDetails) PathAppURL(app App) *url.URL

PathAppURL returns the URL for the given path app.

func (*AppDetails) SubdomainAppURL

func (d *AppDetails) SubdomainAppURL(app App) *url.URL

SubdomainAppURL returns the URL for the given subdomain app.

type Deployment

type Deployment struct {
	Options *DeploymentOptions

	// Client should be logged in as the admin user.
	Client         *codersdk.Client
	FirstUser      codersdk.CreateFirstUserResponse
	PathAppBaseURL *url.URL
}

Deployment is a license-agnostic deployment with all the fields that apps tests need.

type DeploymentFactory

type DeploymentFactory func(t *testing.T, opts *DeploymentOptions) *Deployment

DeploymentFactory generates a deployment with an API client, a path base URL, and a subdomain app host URL.

type DeploymentOptions

type DeploymentOptions struct {
	AppHost                              string
	DisablePathApps                      bool
	DisableSubdomainApps                 bool
	DangerousAllowPathAppSharing         bool
	DangerousAllowPathAppSiteOwnerAccess bool
	// contains filtered or unexported fields
}

DeploymentOptions are the options for creating a *Deployment with a DeploymentFactory.

Jump to

Keyboard shortcuts

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