Fix task update unit test

This commit is contained in:
Sybren A. Stüvel 2022-02-21 20:11:19 +01:00
parent 7111e2613e
commit b3b132fd44
2 changed files with 7 additions and 0 deletions

View File

@ -48,10 +48,13 @@ func TestTaskUpdate(t *testing.T) {
// Construct the task that's supposed to be updated. // Construct the task that's supposed to be updated.
taskID := "181eab68-1123-4790-93b1-94309a899411" taskID := "181eab68-1123-4790-93b1-94309a899411"
jobID := "e4719398-7cfa-4877-9bab-97c2d6c158b5"
mockJob := persistence.Job{UUID: jobID}
mockTask := persistence.Task{ mockTask := persistence.Task{
UUID: taskID, UUID: taskID,
Worker: &worker, Worker: &worker,
WorkerID: &worker.ID, WorkerID: &worker.ID,
Job: &mockJob,
} }
// Expect the task to be fetched. // Expect the task to be fetched.
@ -64,6 +67,8 @@ func TestTaskUpdate(t *testing.T) {
savedTask = *task savedTask = *task
return nil return nil
}) })
// Expect the log to be written.
mf.logStorage.EXPECT().Write(gomock.Any(), jobID, taskID, "line1\nline2\n")
// Do the call. // Do the call.
echoCtx := mf.prepareMockedJSONRequest(&worker, taskUpdate) echoCtx := mf.prepareMockedJSONRequest(&worker, taskUpdate)

View File

@ -39,6 +39,7 @@ type mockedFlamenco struct {
flamenco *Flamenco flamenco *Flamenco
jobCompiler *mocks.MockJobCompiler jobCompiler *mocks.MockJobCompiler
persistence *mocks.MockPersistenceService persistence *mocks.MockPersistenceService
logStorage *mocks.MockLogStorage
config *mocks.MockConfigService config *mocks.MockConfigService
} }
@ -53,6 +54,7 @@ func newMockedFlamenco(mockCtrl *gomock.Controller) mockedFlamenco {
flamenco: f, flamenco: f,
jobCompiler: jc, jobCompiler: jc,
persistence: ps, persistence: ps,
logStorage: ls,
config: cs, config: cs,
} }
} }