From 11b4647f33529a608166e01ca9519de5e25a048b Mon Sep 17 00:00:00 2001 From: kylecarbs Date: Sun, 26 Jun 2022 19:39:42 +0000 Subject: [PATCH] fix: Update database fake to check for nil time when streaming logs This caused a test flake seen here: https://github.com/coder/coder/runs/7056544834?check_suite_focus=true --- coderd/database/databasefake/databasefake.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/coderd/database/databasefake/databasefake.go b/coderd/database/databasefake/databasefake.go index c4757075d397c..644d74b513436 100644 --- a/coderd/database/databasefake/databasefake.go +++ b/coderd/database/databasefake/databasefake.go @@ -1360,10 +1360,10 @@ func (q *fakeQuerier) GetProvisionerLogsByIDBetween(_ context.Context, arg datab if jobLog.JobID.String() != arg.JobID.String() { continue } - if jobLog.CreatedAt.After(arg.CreatedBefore) { + if !arg.CreatedBefore.IsZero() && jobLog.CreatedAt.After(arg.CreatedBefore) { continue } - if jobLog.CreatedAt.Before(arg.CreatedAfter) { + if !arg.CreatedAfter.IsZero() && jobLog.CreatedAt.Before(arg.CreatedAfter) { continue } logs = append(logs, jobLog)