Skip to content

Commit

Permalink
Add some tests for the AutoScaler
Browse files Browse the repository at this point in the history
  • Loading branch information
toofishes committed Nov 1, 2011
1 parent b0fc8fe commit 37d35ed
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions celery/tests/test_worker/test_worker_autoscale.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,25 @@ def test_shrink_raises_ValueError(self):
x.scale_down(1)
self.assertTrue(x.logger.debug.call_count)

def test_update_and_force(self):
x = autoscale.Autoscaler(self.pool, 10, 3, logger=logger)
self.assertEqual(x.processes, 3)
x.force_scale_up(5)
self.assertEqual(x.processes, 8)
x.update(5, None)
self.assertEqual(x.processes, 5)
x.force_scale_down(3)
self.assertEqual(x.processes, 2)
x.update(3, None)
self.assertEqual(x.processes, 3)

def test_info(self):
x = autoscale.Autoscaler(self.pool, 10, 3, logger=logger)
info = x.info()
self.assertEqual(info['max'], 10)
self.assertEqual(info['min'], 3)
self.assertEqual(info['current'], 3)

@patch("os._exit")
def test_thread_crash(self, _exit):

Expand Down

0 comments on commit 37d35ed

Please sign in to comment.