coderdtest

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2022 License: AGPL-3.0 Imports: 42 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AwaitTemplateVersionJob added in v0.4.0

func AwaitTemplateVersionJob(t *testing.T, client *codersdk.Client, version uuid.UUID) codersdk.TemplateVersion

AwaitTemplateImportJob awaits for an import job to reach completed status.

func AwaitWorkspaceAgents

func AwaitWorkspaceAgents(t *testing.T, client *codersdk.Client, build uuid.UUID) []codersdk.WorkspaceResource

AwaitWorkspaceAgents waits for all resources with agents to be connected.

func AwaitWorkspaceBuildJob

func AwaitWorkspaceBuildJob(t *testing.T, client *codersdk.Client, build uuid.UUID) codersdk.WorkspaceBuild

AwaitWorkspaceBuildJob waits for a workspace provision job to reach completed status.

func CreateAnotherUser

func CreateAnotherUser(t *testing.T, client *codersdk.Client, organizationID uuid.UUID) *codersdk.Client

CreateAnotherUser creates and authenticates a new user.

func CreateFirstUser

func CreateFirstUser(t *testing.T, client *codersdk.Client) codersdk.CreateFirstUserResponse

CreateFirstUser creates a user with preset credentials and authenticates with the passed in codersdk client.

func CreateTemplate added in v0.4.0

func CreateTemplate(t *testing.T, client *codersdk.Client, organization uuid.UUID, version uuid.UUID) codersdk.Template

CreateTemplate creates a template with the "echo" provisioner for compatibility with testing. The name assigned is randomly generated.

func CreateTemplateVersion added in v0.4.0

func CreateTemplateVersion(t *testing.T, client *codersdk.Client, organizationID uuid.UUID, res *echo.Responses) codersdk.TemplateVersion

CreateTemplateVersion creates a template import provisioner job with the responses provided. It uses the "echo" provisioner for compatibility with testing.

func CreateWorkspace

func CreateWorkspace(t *testing.T, client *codersdk.Client, user uuid.UUID, templateID uuid.UUID) codersdk.Workspace

CreateWorkspace creates a workspace for the user and template provided. A random name is generated for it.

func New

func New(t *testing.T, options *Options) *codersdk.Client

New constructs an in-memory coderd instance and returns the connected client.

func NewAWSInstanceIdentity

func NewAWSInstanceIdentity(t *testing.T, instanceID string) (awsidentity.Certificates, *http.Client)

NewAWSInstanceIdentity returns a metadata client and ID token validator for faking instance authentication for AWS.

func NewGoogleInstanceIdentity

func NewGoogleInstanceIdentity(t *testing.T, instanceID string, expired bool) (*idtoken.Validator, *metadata.Client)

NewGoogleInstanceIdentity returns a metadata client and ID token validator for faking instance authentication for Google Cloud. nolint:revive

func NewProvisionerDaemon

func NewProvisionerDaemon(t *testing.T, client *codersdk.Client) io.Closer

NewProvisionerDaemon launches a provisionerd instance configured to work well with coderd testing. It registers the "echo" provisioner for quick testing.

Types

type Options

type Options struct {
	AWSInstanceIdentity    awsidentity.Certificates
	GoogleInstanceIdentity *idtoken.Validator
	SSHKeygenAlgorithm     gitsshkey.Algorithm
}

Jump to

Keyboard shortcuts

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