Add regression test for rescheduled idle runner.

This commit is contained in:
Maximilian Paß
2023-08-29 23:05:15 +02:00
committed by Sebastian Serth
parent 8820938624
commit 67297ec5a2

View File

@ -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)
}) })