From a8cc893cf1f9d32312b4570cb7e68ae0b7c862e4 Mon Sep 17 00:00:00 2001 From: Johan Brandhorst-Satzkorn Date: Fri, 23 Aug 2024 16:23:32 -0700 Subject: [PATCH] internal/daemon: simplify time update tests Using time.After makes the intent clearer --- internal/daemon/controller/testing.go | 2 +- internal/daemon/worker/status.go | 2 +- internal/daemon/worker/worker.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/daemon/controller/testing.go b/internal/daemon/controller/testing.go index 92cd8552ef..4124763a65 100644 --- a/internal/daemon/controller/testing.go +++ b/internal/daemon/controller/testing.go @@ -941,7 +941,7 @@ func (tc *TestController) WaitForNextWorkerStatusUpdate(workerStatusName string) break } - if waitStatusCurrent.Sub(waitStatusStart) > 0 { + if waitStatusCurrent.After(waitStatusStart) { break } } diff --git a/internal/daemon/worker/status.go b/internal/daemon/worker/status.go index 31d26f1372..3d391201bf 100644 --- a/internal/daemon/worker/status.go +++ b/internal/daemon/worker/status.go @@ -110,7 +110,7 @@ func (w *Worker) WaitForNextSuccessfulStatusUpdate() error { return ctx.Err() } - if w.lastSuccessfulStatusTime().Sub(waitStatusStart) > 0 { + if w.lastSuccessfulStatusTime().After(waitStatusStart) { break } } diff --git a/internal/daemon/worker/worker.go b/internal/daemon/worker/worker.go index 932fc39b6c..6562bf141c 100644 --- a/internal/daemon/worker/worker.go +++ b/internal/daemon/worker/worker.go @@ -715,7 +715,7 @@ func (w *Worker) Shutdown() error { break } - if w.lastSuccessfulStatusTime().Sub(waitStatusStart) > 0 { + if w.lastSuccessfulStatusTime().After(waitStatusStart) { break }