Skip to content

Commit 3fb9788

Browse files
committed
undiff
1 parent ea9a1da commit 3fb9788

File tree

1 file changed

+44
-41
lines changed

1 file changed

+44
-41
lines changed

cli/provisionerjobs_test.go

Lines changed: 44 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -68,59 +68,62 @@ func TestProvisionerJobs(t *testing.T) {
6868
// Test helper to create a workspace build job with a predefined input.
6969
prepareWorkspaceBuildJob := func(t *testing.T) database.ProvisionerJob {
7070
t.Helper()
71-
wbID := uuid.New()
72-
input, _ := json.Marshal(map[string]string{"workspace_build_id": wbID.String()})
73-
job := prepareJob(t, database.ProvisionerJobTypeWorkspaceBuild, input)
74-
75-
w := dbgen.Workspace(t, db, database.WorkspaceTable{
76-
OrganizationID: owner.OrganizationID,
77-
OwnerID: member.ID,
78-
TemplateID: template.ID,
79-
})
80-
_ = dbgen.WorkspaceBuild(t, db, database.WorkspaceBuild{
81-
ID: wbID,
82-
InitiatorID: member.ID,
83-
WorkspaceID: w.ID,
84-
TemplateVersionID: version.ID,
85-
JobID: job.ID,
86-
})
71+
var (
72+
wbID = uuid.New()
73+
input, _ = json.Marshal(map[string]string{"workspace_build_id": wbID.String()})
74+
job = prepareJob(t, database.ProvisionerJobTypeWorkspaceBuild, input)
75+
w = dbgen.Workspace(t, db, database.WorkspaceTable{
76+
OrganizationID: owner.OrganizationID,
77+
OwnerID: member.ID,
78+
TemplateID: template.ID,
79+
})
80+
_ = dbgen.WorkspaceBuild(t, db, database.WorkspaceBuild{
81+
ID: wbID,
82+
InitiatorID: member.ID,
83+
WorkspaceID: w.ID,
84+
TemplateVersionID: version.ID,
85+
JobID: job.ID,
86+
})
87+
)
8788
return job
8889
}
8990

9091
// Test helper to create a template version import job with a predefined input.
9192
prepareTemplateVersionImportJob := func(t *testing.T) database.ProvisionerJob {
9293
t.Helper()
93-
tvID := uuid.New()
94-
input, _ := json.Marshal(map[string]string{"template_version_id": tvID.String()})
95-
job := prepareJob(t, database.ProvisionerJobTypeTemplateVersionImport, input)
96-
97-
_ = dbgen.TemplateVersion(t, db, database.TemplateVersion{
98-
OrganizationID: owner.OrganizationID,
99-
CreatedBy: templateAdmin.ID,
100-
ID: tvID,
101-
TemplateID: uuid.NullUUID{UUID: template.ID, Valid: true},
102-
JobID: job.ID,
103-
})
94+
var (
95+
tvID = uuid.New()
96+
input, _ = json.Marshal(map[string]string{"template_version_id": tvID.String()})
97+
job = prepareJob(t, database.ProvisionerJobTypeTemplateVersionImport, input)
98+
_ = dbgen.TemplateVersion(t, db, database.TemplateVersion{
99+
OrganizationID: owner.OrganizationID,
100+
CreatedBy: templateAdmin.ID,
101+
ID: tvID,
102+
TemplateID: uuid.NullUUID{UUID: template.ID, Valid: true},
103+
JobID: job.ID,
104+
})
105+
)
104106
return job
105107
}
106108

107109
// Test helper to create a template version import dry run job with a predefined input.
108110
prepareTemplateVersionImportJobDryRun := func(t *testing.T) database.ProvisionerJob {
109111
t.Helper()
110-
tvID := uuid.New()
111-
input, _ := json.Marshal(map[string]interface{}{
112-
"template_version_id": tvID.String(),
113-
"dry_run": true,
114-
})
115-
job := prepareJob(t, database.ProvisionerJobTypeTemplateVersionDryRun, input)
116-
117-
_ = dbgen.TemplateVersion(t, db, database.TemplateVersion{
118-
OrganizationID: owner.OrganizationID,
119-
CreatedBy: templateAdmin.ID,
120-
ID: tvID,
121-
TemplateID: uuid.NullUUID{UUID: template.ID, Valid: true},
122-
JobID: job.ID,
123-
})
112+
var (
113+
tvID = uuid.New()
114+
input, _ = json.Marshal(map[string]interface{}{
115+
"template_version_id": tvID.String(),
116+
"dry_run": true,
117+
})
118+
job = prepareJob(t, database.ProvisionerJobTypeTemplateVersionDryRun, input)
119+
_ = dbgen.TemplateVersion(t, db, database.TemplateVersion{
120+
OrganizationID: owner.OrganizationID,
121+
CreatedBy: templateAdmin.ID,
122+
ID: tvID,
123+
TemplateID: uuid.NullUUID{UUID: template.ID, Valid: true},
124+
JobID: job.ID,
125+
})
126+
)
124127
return job
125128
}
126129

0 commit comments

Comments
 (0)