Documentation
¶
Index ¶
- Constants
- func AddUserToTeam(t *testing.T, db *client.Client, teamID uuid.UUID, userID string)
- func BuildSimpleTemplate(tb testing.TB, names []string, reqEditors ...api.RequestEditorFn) *api.TemplateRequestResponseV3
- func BuildTemplate(tb testing.TB, opts TemplateBuildOptions) *api.TemplateRequestResponseV3
- func CreateAPIKey(t *testing.T, ctx context.Context, c *api.ClientWithResponses, userID string, ...) string
- func CreateAccessToken(t *testing.T, db *client.Client, userID uuid.UUID) string
- func CreateDir(tb testing.TB, sbx *api.Sandbox, path string)
- func CreateTeam(t *testing.T, db *client.Client, teamName string) uuid.UUID
- func CreateTeamWithUser(t *testing.T, db *client.Client, teamName, userID string) uuid.UUID
- func CreateTextFile(tb testing.TB, path string, content string) (*bytes.Buffer, string)
- func CreateUser(t *testing.T, db *client.Client) uuid.UUID
- func ExecCommand(tb testing.TB, ctx context.Context, sbx *api.Sandbox, ...) error
- func ExecCommandAsRoot(tb testing.TB, ctx context.Context, sbx *api.Sandbox, ...) error
- func ExecCommandAsRootWithOutput(tb testing.TB, ctx context.Context, sbx *api.Sandbox, ...) (string, error)
- func ExecCommandWithCwd(tb testing.TB, ctx context.Context, sbx *api.Sandbox, ...) error
- func ExecCommandWithOptions(tb testing.TB, ctx context.Context, sbx *api.Sandbox, ...) error
- func ExecCommandWithOutput(tb testing.TB, ctx context.Context, sbx *api.Sandbox, ...) (string, error)
- func NewRequest(sbx *api.Sandbox, url *url.URL, port int, extraHeaders *http.Header) *http.Request
- func SetupSandboxWithCleanup(t *testing.T, c *api.ClientWithResponses, options ...SandboxOption) *api.Sandbox
- func TeardownSandbox(t *testing.T, c *api.ClientWithResponses, sandboxID string)
- func UploadFile(tb testing.TB, ctx context.Context, sbx *api.Sandbox, ...)
- func WaitForBuildCompletion(tb testing.TB, ctx context.Context, templateID string, buildID string, ...)
- func WaitForStatus(tb testing.TB, client *http.Client, sbx *api.Sandbox, url *url.URL, port int, ...) *http.Response
- type BuildLogHandler
- type SandboxConfig
- type SandboxOption
- func WithAllowInternetAccess(allow bool) SandboxOption
- func WithAutoPause(autoPause bool) SandboxOption
- func WithMetadata(metadata api.SandboxMetadata) SandboxOption
- func WithNetwork(network *api.SandboxNetworkConfig) SandboxOption
- func WithSecure(secure bool) SandboxOption
- func WithTemplateID(templateID string) SandboxOption
- func WithTimeout(timeout int32) SandboxOption
- func WithoutAnyMetadata() SandboxOption
- type TemplateBuildOptions
Constants ¶
View Source
const ( DefaultBuildTimeout = 5 * time.Minute DefaultCPUCount = int32(2) DefaultMemoryMB = int32(1024) )
Variables ¶
This section is empty.
Functions ¶
func AddUserToTeam ¶
func BuildSimpleTemplate ¶
func BuildSimpleTemplate(tb testing.TB, names []string, reqEditors ...api.RequestEditorFn) *api.TemplateRequestResponseV3
BuildSimpleTemplate builds a simple template with Ubuntu 22.04 base image
func BuildTemplate ¶
func BuildTemplate(tb testing.TB, opts TemplateBuildOptions) *api.TemplateRequestResponseV3
BuildTemplate builds a template with the given options and waits for it to complete
func CreateAPIKey ¶
func CreateAccessToken ¶
func CreateTeamWithUser ¶
func CreateTextFile ¶
func ExecCommand ¶
func ExecCommandAsRoot ¶
func ExecCommandWithCwd ¶
func ExecCommandWithOptions ¶
func ExecCommandWithOutput ¶
func NewRequest ¶
func SetupSandboxWithCleanup ¶
func SetupSandboxWithCleanup(t *testing.T, c *api.ClientWithResponses, options ...SandboxOption) *api.Sandbox
SetupSandboxWithCleanup creates a new sandbox and returns its data
func TeardownSandbox ¶
func TeardownSandbox(t *testing.T, c *api.ClientWithResponses, sandboxID string)
TeardownSandbox kills the sandbox with the given ID
func UploadFile ¶
func WaitForBuildCompletion ¶
func WaitForBuildCompletion( tb testing.TB, ctx context.Context, templateID string, buildID string, alias string, logHandler BuildLogHandler, enableDebug bool, reqEditors ...api.RequestEditorFn, )
WaitForBuildCompletion waits for a template build to complete
Types ¶
type BuildLogHandler ¶
type BuildLogHandler func(alias string, entry api.BuildLogEntry)
BuildLogHandler is a function that handles build log entries
func DefaultBuildLogHandler ¶
func DefaultBuildLogHandler(tb testing.TB) BuildLogHandler
DefaultBuildLogHandler returns a default log handler that logs to the test logger
func NoOpBuildLogHandler ¶
func NoOpBuildLogHandler() BuildLogHandler
NoOpBuildLogHandler returns a log handler that does nothing
type SandboxConfig ¶
type SandboxConfig struct {
// contains filtered or unexported fields
}
type SandboxOption ¶
type SandboxOption func(config *SandboxConfig)
func WithAllowInternetAccess ¶
func WithAllowInternetAccess(allow bool) SandboxOption
func WithAutoPause ¶
func WithAutoPause(autoPause bool) SandboxOption
func WithMetadata ¶
func WithMetadata(metadata api.SandboxMetadata) SandboxOption
func WithNetwork ¶
func WithNetwork(network *api.SandboxNetworkConfig) SandboxOption
func WithSecure ¶
func WithSecure(secure bool) SandboxOption
func WithTemplateID ¶
func WithTemplateID(templateID string) SandboxOption
func WithTimeout ¶
func WithTimeout(timeout int32) SandboxOption
func WithoutAnyMetadata ¶
func WithoutAnyMetadata() SandboxOption
type TemplateBuildOptions ¶
type TemplateBuildOptions struct {
Names []string
CPUCount *int32
MemoryMB *int32
BuildData api.TemplateBuildStartV2
Timeout time.Duration
LogHandler BuildLogHandler
EnableDebug bool
ReqEditors []api.RequestEditorFn
}
TemplateBuildOptions contains options for building a template
Click to show internal directories.
Click to hide internal directories.