Fix #99549: Remember Previous Status #104217
@ -259,45 +259,6 @@ func TestWorkerSignoffTaskRequeue(t *testing.T) {
|
||||
assert.Equal(t, http.StatusNoContent, resp.StatusCode)
|
||||
}
|
||||
|
||||
func TestWorkerSignoffStatusChangeRequest(t *testing.T) {
|
||||
mockCtrl := gomock.NewController(t)
|
||||
defer mockCtrl.Finish()
|
||||
|
||||
mf := newMockedFlamenco(mockCtrl)
|
||||
worker := testWorker()
|
||||
worker.Status = api.WorkerStatusAwake
|
||||
worker.StatusChangeRequest(api.WorkerStatusOffline, true)
|
||||
|
||||
mf.broadcaster.EXPECT().BroadcastWorkerUpdate(api.SocketIOWorkerUpdate{
|
||||
Id: worker.UUID,
|
||||
Name: worker.Name,
|
||||
PreviousStatus: ptr(api.WorkerStatusAwake),
|
||||
Status: api.WorkerStatusOffline,
|
||||
StatusChange: &api.WorkerStatusChangeRequest{
|
||||
IsLazy: false,
|
||||
Status: api.WorkerStatusAwake,
|
||||
},
|
||||
Updated: worker.UpdatedAt,
|
||||
Version: worker.Software,
|
||||
})
|
||||
|
||||
// Expect the Worker to be saved with the status change removed.
|
||||
savedWorker := worker
|
||||
savedWorker.Status = api.WorkerStatusOffline
|
||||
savedWorker.StatusChangeClear()
|
||||
mf.persistence.EXPECT().SaveWorkerStatus(gomock.Any(), &savedWorker).Return(nil)
|
||||
|
||||
mf.stateMachine.EXPECT().RequeueActiveTasksOfWorker(gomock.Any(), &worker, "worker signed off").Return(nil)
|
||||
mf.persistence.EXPECT().WorkerSeen(gomock.Any(), &worker)
|
||||
|
||||
// Perform the request
|
||||
echo := mf.prepareMockedRequest(nil)
|
||||
requestWorkerStore(echo, &worker)
|
||||
err := mf.flamenco.SignOff(echo)
|
||||
assert.NoError(t, err)
|
||||
assertResponseNoContent(t, echo)
|
||||
}
|
||||
|
||||
func TestWorkerRememberPreviousStatus(t *testing.T) {
|
||||
mockCtrl := gomock.NewController(t)
|
||||
defer mockCtrl.Finish()
|
||||
|
Loading…
Reference in New Issue
Block a user