Add regression test for rescheduled idle runner.
This commit is contained in:

committed by
Sebastian Serth

parent
8820938624
commit
67297ec5a2
@ -373,6 +373,15 @@ func (s *ManagerTestSuite) TestOnAllocationAdded() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *ManagerTestSuite) TestOnAllocationStopped() {
|
func (s *ManagerTestSuite) TestOnAllocationStopped() {
|
||||||
|
s.Run("returns false for idle runner", func() {
|
||||||
|
environment, ok := s.nomadRunnerManager.environments.Get(tests.DefaultEnvironmentIDAsString)
|
||||||
|
s.Require().True(ok)
|
||||||
|
mockIdleRunners(environment.(*ExecutionEnvironmentMock))
|
||||||
|
|
||||||
|
environment.AddRunner(NewNomadJob(tests.DefaultRunnerID, []nomadApi.PortMapping{}, s.apiMock, func(r Runner) error { return nil }))
|
||||||
|
alreadyRemoved := s.nomadRunnerManager.onAllocationStopped(tests.DefaultRunnerID, nil)
|
||||||
|
s.False(alreadyRemoved)
|
||||||
|
})
|
||||||
s.Run("stops inactivity timer", func() {
|
s.Run("stops inactivity timer", func() {
|
||||||
testStoppedInactivityTimer(s, true)
|
testStoppedInactivityTimer(s, true)
|
||||||
})
|
})
|
||||||
|
Reference in New Issue
Block a user