Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions coderd/database/dbfake/dbfake.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ type TemplateVersionBuilder struct {
t testing.TB
db database.Store
seed database.TemplateVersion
fileID uuid.UUID
ps pubsub.Pubsub
resources []*sdkproto.Resource
params []database.TemplateVersionParameter
Expand All @@ -296,6 +297,12 @@ func (t TemplateVersionBuilder) Seed(v database.TemplateVersion) TemplateVersion
return t
}

func (t TemplateVersionBuilder) FileID(fid uuid.UUID) TemplateVersionBuilder {
// nolint: revive // returns modified struct
t.fileID = fid
return t
}

func (t TemplateVersionBuilder) Pubsub(ps pubsub.Pubsub) TemplateVersionBuilder {
// nolint: revive // returns modified struct
t.ps = ps
Expand All @@ -320,6 +327,8 @@ func (t TemplateVersionBuilder) Do() TemplateVersionResponse {
t.seed.OrganizationID = takeFirst(t.seed.OrganizationID, uuid.New())
t.seed.ID = takeFirst(t.seed.ID, uuid.New())
t.seed.CreatedBy = takeFirst(t.seed.CreatedBy, uuid.New())
// nolint: revive
t.fileID = takeFirst(t.fileID, uuid.New())
Comment on lines +330 to +331
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

heads-up: the linter has started complaining about this, we may want to consider squelching this rule for this particular case.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What rule is the problem?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


var resp TemplateVersionResponse
if t.seed.TemplateID.UUID == uuid.Nil {
Expand Down Expand Up @@ -361,6 +370,7 @@ func (t TemplateVersionBuilder) Do() TemplateVersionResponse {
Time: dbtime.Now(),
Valid: true,
},
FileID: t.fileID,
})

t.seed.JobID = job.ID
Expand Down