From 4a91d09b2af98a454f37d6c86d641284960a7b36 Mon Sep 17 00:00:00 2001 From: Jon Ayers Date: Fri, 8 Dec 2023 01:17:15 +0000 Subject: [PATCH] chore: fix flake in TestExecutorAutostopTemplateDisabled --- coderd/autobuild/lifecycle_executor_test.go | 4 ++-- coderd/provisionerdserver/provisionerdserver.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/coderd/autobuild/lifecycle_executor_test.go b/coderd/autobuild/lifecycle_executor_test.go index f6d0c7caf4c21..5e7aaffc5ba2e 100644 --- a/coderd/autobuild/lifecycle_executor_test.go +++ b/coderd/autobuild/lifecycle_executor_test.go @@ -817,7 +817,7 @@ func TestExecutorAutostopTemplateDisabled(t *testing.T) { // When: the autobuild executor ticks after the workspace setting, but before the template setting: go func() { - tickCh <- workspace.LatestBuild.CreatedAt.Add(45 * time.Minute) + tickCh <- workspace.LatestBuild.Job.CompletedAt.Add(45 * time.Minute) }() // Then: nothing should happen @@ -827,7 +827,7 @@ func TestExecutorAutostopTemplateDisabled(t *testing.T) { // When: the autobuild executor ticks after the template setting: go func() { - tickCh <- workspace.LatestBuild.CreatedAt.Add(61 * time.Minute) + tickCh <- workspace.LatestBuild.Job.CompletedAt.Add(61 * time.Minute) close(tickCh) }() diff --git a/coderd/provisionerdserver/provisionerdserver.go b/coderd/provisionerdserver/provisionerdserver.go index 283692d01145f..250308bf93489 100644 --- a/coderd/provisionerdserver/provisionerdserver.go +++ b/coderd/provisionerdserver/provisionerdserver.go @@ -1131,9 +1131,9 @@ func (s *server) CompleteJob(ctx context.Context, completed *proto.CompletedJob) err = db.UpdateProvisionerJobWithCompleteByID(ctx, database.UpdateProvisionerJobWithCompleteByIDParams{ ID: jobID, - UpdatedAt: dbtime.Now(), + UpdatedAt: now, CompletedAt: sql.NullTime{ - Time: dbtime.Now(), + Time: now, Valid: true, }, Error: sql.NullString{},