MCPcopy Index your code
hub / github.com/coder/coder / setJobStatus

Function setJobStatus

coderd/database/querier_test.go:4558–4590  ·  view source on GitHub ↗
(t testing.TB, status database.ProvisionerJobStatus, j *database.ProvisionerJob)

Source from the content-addressed store, hash-verified

4556}
4557
4558func setJobStatus(t testing.TB, status database.ProvisionerJobStatus, j *database.ProvisionerJob) {
4559 t.Helper()
4560
4561 earlier := sql.NullTime{
4562 Time: dbtime.Now().Add(time.Second * -30),
4563 Valid: true,
4564 }
4565 now := sql.NullTime{
4566 Time: dbtime.Now(),
4567 Valid: true,
4568 }
4569 switch status {
4570 case database.ProvisionerJobStatusRunning:
4571 j.StartedAt = earlier
4572 case database.ProvisionerJobStatusPending:
4573 case database.ProvisionerJobStatusFailed:
4574 j.StartedAt = earlier
4575 j.CompletedAt = now
4576 j.Error = sql.NullString{
4577 String: "failed",
4578 Valid: true,
4579 }
4580 j.ErrorCode = sql.NullString{
4581 String: "failed",
4582 Valid: true,
4583 }
4584 case database.ProvisionerJobStatusSucceeded:
4585 j.StartedAt = earlier
4586 j.CompletedAt = now
4587 default:
4588 t.Fatalf("invalid status: %s", status)
4589 }
4590}
4591
4592func TestArchiveVersions(t *testing.T) {
4593 t.Parallel()

Calls 4

NowFunction · 0.92
HelperMethod · 0.65
AddMethod · 0.65
FatalfMethod · 0.45

Tested by

no test coverage detected