Add regression test for rescheduled used runners being removed.
As they are already rescheduled and therefore recreated they do not need to be removed, but can be handled as a new runner.
This commit is contained in:

committed by
Sebastian Serth

parent
90d591d4ec
commit
6dc83ca7b5
@ -105,6 +105,33 @@ func (s *MainTestSuite) TestFromContextReturnsIsNotOkWhenContextHasNoRunner() {
|
|||||||
s.False(ok)
|
s.False(ok)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *MainTestSuite) TestDestroyDoesNotPropagateToNomadForSomeReasons() {
|
||||||
|
apiMock := &nomad.ExecutorAPIMock{}
|
||||||
|
timer := &InactivityTimerMock{}
|
||||||
|
timer.On("StopTimeout").Return()
|
||||||
|
ctx, cancel := context.WithCancel(s.TestCtx)
|
||||||
|
r := &NomadJob{
|
||||||
|
executions: storage.NewLocalStorage[*dto.ExecutionRequest](),
|
||||||
|
InactivityTimer: timer,
|
||||||
|
id: tests.DefaultRunnerID,
|
||||||
|
api: apiMock,
|
||||||
|
ctx: ctx,
|
||||||
|
cancel: cancel,
|
||||||
|
}
|
||||||
|
|
||||||
|
s.Run("destroy removes the runner only locally for OOM Killed Allocations", func() {
|
||||||
|
err := r.Destroy(ErrOOMKilled)
|
||||||
|
s.NoError(err)
|
||||||
|
apiMock.AssertExpectations(s.T())
|
||||||
|
})
|
||||||
|
|
||||||
|
s.Run("destroy removes the runner only locally for rescheduled allocations", func() {
|
||||||
|
err := r.Destroy(nomad.ErrorAllocationRescheduled)
|
||||||
|
s.NoError(err)
|
||||||
|
apiMock.AssertExpectations(s.T())
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
func TestExecuteInteractivelyTestSuite(t *testing.T) {
|
func TestExecuteInteractivelyTestSuite(t *testing.T) {
|
||||||
suite.Run(t, new(ExecuteInteractivelyTestSuite))
|
suite.Run(t, new(ExecuteInteractivelyTestSuite))
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user