Documentation ¶
Index ¶
- Variables
- func AwaitTemplateVersionJob(t *testing.T, client *codersdk.Client, version uuid.UUID) codersdk.TemplateVersion
- func AwaitWorkspaceAgents(t *testing.T, client *codersdk.Client, build uuid.UUID) []codersdk.WorkspaceResource
- func AwaitWorkspaceBuildJob(t *testing.T, client *codersdk.Client, build uuid.UUID) codersdk.WorkspaceBuild
- func CreateAnotherUser(t *testing.T, client *codersdk.Client, organizationID uuid.UUID, ...) *codersdk.Client
- func CreateFirstUser(t *testing.T, client *codersdk.Client) codersdk.CreateFirstUserResponse
- func CreateTemplate(t *testing.T, client *codersdk.Client, organization uuid.UUID, ...) codersdk.Template
- func CreateTemplateVersion(t *testing.T, client *codersdk.Client, organizationID uuid.UUID, ...) codersdk.TemplateVersion
- func CreateWorkspace(t *testing.T, client *codersdk.Client, organization uuid.UUID, ...) codersdk.Workspace
- func CreateWorkspaceBuild(t *testing.T, client *codersdk.Client, workspace codersdk.Workspace, ...) codersdk.WorkspaceBuild
- func MustTransitionWorkspace(t *testing.T, client *codersdk.Client, workspaceID uuid.UUID, ...) codersdk.Workspace
- func MustWorkspace(t *testing.T, client *codersdk.Client, workspaceID uuid.UUID) codersdk.Workspace
- func New(t *testing.T, options *Options) *codersdk.Client
- func NewAWSInstanceIdentity(t *testing.T, instanceID string) (awsidentity.Certificates, *http.Client)
- func NewAzureInstanceIdentity(t *testing.T, instanceID string) (x509.VerifyOptions, *http.Client)
- func NewGoogleInstanceIdentity(t *testing.T, instanceID string, expired bool) (*idtoken.Validator, *metadata.Client)
- func NewProvisionerDaemon(t *testing.T, coderAPI *coderd.API) io.Closer
- func NewWithAPI(t *testing.T, options *Options) (*codersdk.Client, *coderd.API)
- func UpdateTemplateVersion(t *testing.T, client *codersdk.Client, organizationID uuid.UUID, ...) codersdk.TemplateVersion
- type Options
Constants ¶
This section is empty.
Variables ¶
var FirstUserParams = codersdk.CreateFirstUserRequest{
Email: "testuser@coder.com",
Username: "testuser",
Password: "testpass",
OrganizationName: "testorg",
}
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, roles ...string) *codersdk.Client
CreateAnotherUser creates and authenticates a new user.
func CreateFirstUser ¶
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, mutators ...func(*codersdk.CreateTemplateRequest)) 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, organization uuid.UUID, templateID uuid.UUID, mutators ...func(*codersdk.CreateWorkspaceRequest)) codersdk.Workspace
CreateWorkspace creates a workspace for the user and template provided. A random name is generated for it. To customize the defaults, pass a mutator func.
func CreateWorkspaceBuild ¶ added in v0.6.0
func CreateWorkspaceBuild( t *testing.T, client *codersdk.Client, workspace codersdk.Workspace, transition database.WorkspaceTransition) codersdk.WorkspaceBuild
CreateWorkspaceBuild creates a workspace build for the given workspace and transition.
func MustTransitionWorkspace ¶ added in v0.6.3
func MustTransitionWorkspace(t *testing.T, client *codersdk.Client, workspaceID uuid.UUID, from, to database.WorkspaceTransition) codersdk.Workspace
TransitionWorkspace is a convenience method for transitioning a workspace from one state to another.
func MustWorkspace ¶ added in v0.6.3
MustWorkspace is a convenience method for fetching a workspace that should exist.
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 NewAzureInstanceIdentity ¶ added in v0.4.4
NewAzureInstanceIdentity returns a metadata client and ID token validator for faking instance authentication for Azure.
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 ¶
NewProvisionerDaemon launches a provisionerd instance configured to work well with coderd testing. It registers the "echo" provisioner for quick testing.
func NewWithAPI ¶ added in v0.6.1
NewWithAPI constructs a codersdk client connected to the returned in-memory API instance.
func UpdateTemplateVersion ¶ added in v0.5.6
func UpdateTemplateVersion(t *testing.T, client *codersdk.Client, organizationID uuid.UUID, res *echo.Responses, templateID uuid.UUID) codersdk.TemplateVersion
UpdateTemplateVersion creates a new template version with the "echo" provisioner and associates it with the given templateID.
Types ¶
type Options ¶
type Options struct { AWSCertificates awsidentity.Certificates Authorizer rbac.Authorizer AzureCertificates x509.VerifyOptions GithubOAuth2Config *coderd.GithubOAuth2Config GoogleTokenValidator *idtoken.Validator SSHKeygenAlgorithm gitsshkey.Algorithm APIRateLimit int AutobuildTicker <-chan time.Time AutobuildStats chan<- executor.Stats // IncludeProvisionerD when true means to start an in-memory provisionerD IncludeProvisionerD bool }