From 40f711bf69062dd480edffb8230c506069db1ca1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Thu, 16 Jun 2022 10:42:04 +0200 Subject: [PATCH] Fix two unit tests for the previous commit I pushed too soon :'( --- internal/manager/api_impl/workers_test.go | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/internal/manager/api_impl/workers_test.go b/internal/manager/api_impl/workers_test.go index ecab9fe0..713a5645 100644 --- a/internal/manager/api_impl/workers_test.go +++ b/internal/manager/api_impl/workers_test.go @@ -88,11 +88,13 @@ func TestTaskScheduleNonActiveStatus(t *testing.T) { worker := testWorker() worker.Status = api.WorkerStatusAsleep - // Explicitly NO expected calls to the persistence layer. Since the worker is - // not in a state that allows task execution, there should be no DB queries. - echoCtx := mf.prepareMockedRequest(nil) requestWorkerStore(echoCtx, &worker) + + // The worker should be marked as 'seen', even when it's in a state that + // doesn't allow task execution. + mf.persistence.EXPECT().WorkerSeen(echoCtx.Request().Context(), &worker) + err := mf.flamenco.ScheduleTask(echoCtx) assert.NoError(t, err) @@ -108,11 +110,13 @@ func TestTaskScheduleOtherStatusRequested(t *testing.T) { worker := testWorker() worker.StatusChangeRequest(api.WorkerStatusAsleep, false) - // Explicitly NO expected calls to the persistence layer. Since the worker is - // not in a state that allows task execution, there should be no DB queries. - echoCtx := mf.prepareMockedRequest(nil) requestWorkerStore(echoCtx, &worker) + + // The worker should be marked as 'seen', even when it's in a state that + // doesn't allow task execution. + mf.persistence.EXPECT().WorkerSeen(echoCtx.Request().Context(), &worker) + err := mf.flamenco.ScheduleTask(echoCtx) assert.NoError(t, err)