( ctx context.Context, t *testing.T, clock quartz.Clock, db database.Store, ps pubsub.Pubsub, orgID uuid.UUID, templateID uuid.UUID, templateVersionID uuid.UUID, presetID uuid.UUID, opts ...func(*SetupPrebuiltOptions), )
| 1663 | } |
| 1664 | |
| 1665 | func setupTestDBPrebuiltWorkspace( |
| 1666 | ctx context.Context, |
| 1667 | t *testing.T, |
| 1668 | clock quartz.Clock, |
| 1669 | db database.Store, |
| 1670 | ps pubsub.Pubsub, |
| 1671 | orgID uuid.UUID, |
| 1672 | templateID uuid.UUID, |
| 1673 | templateVersionID uuid.UUID, |
| 1674 | presetID uuid.UUID, |
| 1675 | opts ...func(*SetupPrebuiltOptions), |
| 1676 | ) database.WorkspaceTable { |
| 1677 | t.Helper() |
| 1678 | |
| 1679 | // Optional parameters |
| 1680 | options := &SetupPrebuiltOptions{} |
| 1681 | for _, opt := range opts { |
| 1682 | opt(options) |
| 1683 | } |
| 1684 | |
| 1685 | buildTransition := database.WorkspaceTransitionStart |
| 1686 | if options.IsStopped { |
| 1687 | buildTransition = database.WorkspaceTransitionStop |
| 1688 | } |
| 1689 | |
| 1690 | workspace := dbgen.Workspace(t, db, database.WorkspaceTable{ |
| 1691 | TemplateID: templateID, |
| 1692 | OrganizationID: orgID, |
| 1693 | OwnerID: database.PrebuildsSystemUserID, |
| 1694 | Deleted: false, |
| 1695 | CreatedAt: clock.Now().Add(-time.Hour * 2), |
| 1696 | AutostartSchedule: options.AutostartSchedule, |
| 1697 | LastUsedAt: clock.Now(), |
| 1698 | }) |
| 1699 | setupTestDBWorkspaceBuild(ctx, t, clock, db, ps, orgID, workspace.ID, templateVersionID, presetID, buildTransition) |
| 1700 | |
| 1701 | return workspace |
| 1702 | } |
| 1703 | |
| 1704 | func mustProvisionWorkspace(t *testing.T, client *codersdk.Client, mut ...func(*codersdk.CreateWorkspaceRequest)) codersdk.Workspace { |
| 1705 | t.Helper() |
no test coverage detected