( ctx context.Context, t *testing.T, clock quartz.Clock, db database.Store, ps pubsub.Pubsub, orgID uuid.UUID, userID uuid.UUID, templateID uuid.UUID, )
| 3082 | ) |
| 3083 | |
| 3084 | func setupTestDBTemplateVersion( |
| 3085 | ctx context.Context, |
| 3086 | t *testing.T, |
| 3087 | clock quartz.Clock, |
| 3088 | db database.Store, |
| 3089 | ps pubsub.Pubsub, |
| 3090 | orgID uuid.UUID, |
| 3091 | userID uuid.UUID, |
| 3092 | templateID uuid.UUID, |
| 3093 | ) uuid.UUID { |
| 3094 | t.Helper() |
| 3095 | templateVersionJob := dbgen.ProvisionerJob(t, db, ps, database.ProvisionerJob{ |
| 3096 | CreatedAt: clock.Now().Add(muchEarlier), |
| 3097 | CompletedAt: sql.NullTime{Time: clock.Now().Add(earlier), Valid: true}, |
| 3098 | OrganizationID: orgID, |
| 3099 | InitiatorID: userID, |
| 3100 | }) |
| 3101 | templateVersion := dbgen.TemplateVersion(t, db, database.TemplateVersion{ |
| 3102 | TemplateID: uuid.NullUUID{UUID: templateID, Valid: true}, |
| 3103 | OrganizationID: orgID, |
| 3104 | CreatedBy: userID, |
| 3105 | JobID: templateVersionJob.ID, |
| 3106 | CreatedAt: time.Now().Add(muchEarlier), |
| 3107 | }) |
| 3108 | require.NoError(t, db.UpdateTemplateActiveVersionByID(ctx, database.UpdateTemplateActiveVersionByIDParams{ |
| 3109 | ID: templateID, |
| 3110 | ActiveVersionID: templateVersion.ID, |
| 3111 | })) |
| 3112 | // Make sure immutable params don't break prebuilt workspace deletion logic |
| 3113 | dbgen.TemplateVersionParameter(t, db, database.TemplateVersionParameter{ |
| 3114 | TemplateVersionID: templateVersion.ID, |
| 3115 | Name: "test", |
| 3116 | Description: "required & immutable param", |
| 3117 | Type: "string", |
| 3118 | DefaultValue: "", |
| 3119 | Required: true, |
| 3120 | Mutable: false, |
| 3121 | }) |
| 3122 | return templateVersion.ID |
| 3123 | } |
| 3124 | |
| 3125 | // Preset optional parameters. |
| 3126 | // presetOptions defines a function type for modifying InsertPresetParams. |
no test coverage detected