WIP: Allow jobs to be submitted in paused
status
#104318
@ -336,6 +336,29 @@ func TestJobCancelWithSomeCompletedTasks(t *testing.T) {
|
||||
require.NoError(t, sm.JobStatusChange(ctx, job, api.JobStatusCancelRequested, "someone wrote a unittest"))
|
||||
}
|
||||
|
||||
func TestJobPauseWithAllQueuedTasks(t *testing.T) {
|
||||
mockCtrl, ctx, sm, mocks := taskStateMachineTestFixtures(t)
|
||||
defer mockCtrl.Finish()
|
||||
|
||||
task1 := taskWithStatus(api.JobStatusActive, api.TaskStatusQueued)
|
||||
task2 := taskOfSameJob(task1, api.TaskStatusQueued)
|
||||
task3 := taskOfSameJob(task2, api.TaskStatusQueued)
|
||||
job := task3.Job
|
||||
|
||||
mocks.expectSaveJobWithStatus(t, job, api.JobStatusPauseRequested)
|
||||
|
||||
// Expect pausing of the job to trigger pausing of all its queued tasks.
|
||||
mocks.persist.EXPECT().UpdateJobsTaskStatuses(ctx, job, api.TaskStatusPaused,
|
||||
"Paused because job transitioned status from \"active\" to \"paused\"")
|
||||
|
||||
mocks.expectSaveJobWithStatus(t, job, api.JobStatusPaused)
|
||||
|
||||
mocks.expectBroadcastJobChangeWithTaskRefresh(job, api.JobStatusActive, api.JobStatusPauseRequested)
|
||||
mocks.expectBroadcastJobChange(job, api.JobStatusPauseRequested, api.JobStatusPaused)
|
||||
|
||||
require.NoError(t, sm.JobStatusChange(ctx, job, api.JobStatusPauseRequested, "someone wrote a unittest"))
|
||||
}
|
||||
|
||||
func TestCheckStuck(t *testing.T) {
|
||||
mockCtrl, ctx, sm, mocks := taskStateMachineTestFixtures(t)
|
||||
defer mockCtrl.Finish()
|
||||
|
Loading…
Reference in New Issue
Block a user