mirror of
https://github.com/coder/coder.git
synced 2025-07-03 16:13:58 +00:00
fix: Test flake in TestWorkspaceStatus
(#4333)
This also changes the status to be on the workspace build, since that's where the true value is calculated. This exposed a bug where jobs could never enter the canceled state unless fetched by a provisioner daemon, which was nice to fix! See: https://github.com/coder/coder/actions/runs/3175304200/jobs/5173479506
This commit is contained in:
@ -85,6 +85,11 @@ func (api *API) patchCancelTemplateVersion(rw http.ResponseWriter, r *http.Reque
|
||||
Time: database.Now(),
|
||||
Valid: true,
|
||||
},
|
||||
CompletedAt: sql.NullTime{
|
||||
Time: database.Now(),
|
||||
// If the job is running, don't mark it completed!
|
||||
Valid: !job.WorkerID.Valid,
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
httpapi.Write(ctx, rw, http.StatusInternalServerError, codersdk.Response{
|
||||
@ -339,6 +344,11 @@ func (api *API) patchTemplateVersionDryRunCancel(rw http.ResponseWriter, r *http
|
||||
Time: database.Now(),
|
||||
Valid: true,
|
||||
},
|
||||
CompletedAt: sql.NullTime{
|
||||
Time: database.Now(),
|
||||
// If the job is running, don't mark it completed!
|
||||
Valid: !job.WorkerID.Valid,
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
httpapi.Write(ctx, rw, http.StatusInternalServerError, codersdk.Response{
|
||||
|
Reference in New Issue
Block a user