Skip to content

Commit

Permalink
Add test for eager + running + bad status.
Browse files Browse the repository at this point in the history
  • Loading branch information
tseaver committed Feb 11, 2009
1 parent b684d33 commit 977168c
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions superlance/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,26 @@ def test_runforever_not_eager_none_running(self):
self.assertEqual(len(lines), 0, lines)
self.failIf('mailed' in prog.__dict__)

def test_runforever_not_eager_running(self):
programs = ['foo', 'bar']
any = None
prog = self._makeOnePopulated(programs, any, exc=True, eager=False)
prog.stdin.write('eventname:TICK len:0\n')
prog.stdin.seek(0)
prog.runforever(test=True)
lines = filter(None, prog.stderr.getvalue().split('\n'))
self.assertEqual(lines[0],
("Restarting selected processes ['foo', 'bar']")
)
self.assertEqual(lines[1], 'foo is in RUNNING state, restarting')
self.assertEqual(lines[2], 'foo restarted')
self.assertEqual(lines[3], 'bar not in RUNNING state, NOT restarting')
mailed = prog.mailed.split('\n')
self.assertEqual(len(mailed), 10)
self.assertEqual(mailed[0], 'To: chrism@plope.com')
self.assertEqual(mailed[1],
'Subject: httpok for http://foo/bar: bad status returned')

class CrashMailTests(unittest.TestCase):
def _getTargetClass(self):
from superlance.crashmail import CrashMail
Expand Down

0 comments on commit 977168c

Please sign in to comment.