Skip to content

Commit

Permalink
HH-59459 fix byte strings in supervisor test
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrey Sumin committed Apr 25, 2016
1 parent 9aa8573 commit 1d7d016
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions tests/test_supervisor.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ def test_start_no_action(self):
process = run_supervisor_command('supervisor-testapp', 1234, '')
_, stderr = process.communicate()

self.assertIn('missing action', stderr)
self.assertIn(b'missing action', stderr)
self.assertEqual(1, process.poll())

def test_start_incorrect_action(self):
process = run_supervisor_command('supervisor-testapp', 1234, 'wtf')
_, stderr = process.communicate()

self.assertIn('incorrect action', stderr)
self.assertIn(b'incorrect action', stderr)
self.assertEqual(1, process.poll())

def test_start_restart_stop_status(self):
Expand All @@ -27,53 +27,53 @@ def test_start_restart_stop_status(self):
process = run_supervisor_command(supervisor_script, port, 'start')
_, stderr = process.communicate()

self.assertIn('start worker', stderr)
self.assertIn('all workers are running', stderr)
self.assertIn(b'start worker', stderr)
self.assertIn(b'all workers are running', stderr)
self.assertEqual(0, process.poll())

# Double start

process = run_supervisor_command(supervisor_script, port, 'start')
_, stderr = process.communicate()

self.assertIn('another worker already started on', stderr)
self.assertIn(b'another worker already started on', stderr)
self.assertEqual(0, process.poll())

# Status — running

process = run_supervisor_command(supervisor_script, port, 'status')
_, stderr = process.communicate()

self.assertIn('all workers are running', stderr)
self.assertIn(b'all workers are running', stderr)
self.assertEqual(0, process.poll())

# Restart

process = run_supervisor_command(supervisor_script, port, 'restart')
_, stderr = process.communicate()

self.assertIn('some of the workers are running, trying to kill', stderr)
self.assertIn('stopping worker', stderr)
self.assertIn('start worker', stderr)
self.assertIn('all workers are running', stderr)
self.assertIn(b'some of the workers are running, trying to kill', stderr)
self.assertIn(b'stopping worker', stderr)
self.assertIn(b'start worker', stderr)
self.assertIn(b'all workers are running', stderr)
self.assertEqual(0, process.poll())

# Stop

process = run_supervisor_command(supervisor_script, port, 'stop')
_, stderr = process.communicate()

self.assertIn('some of the workers are running, trying to kill', stderr)
self.assertIn('stopping worker', stderr)
self.assertIn('all workers are stopped', stderr)
self.assertIn(b'some of the workers are running, trying to kill', stderr)
self.assertIn(b'stopping worker', stderr)
self.assertIn(b'all workers are stopped', stderr)
self.assertEqual(0, process.poll())

# Status — stopped

process = run_supervisor_command(supervisor_script, port, 'status')
_, stderr = process.communicate()

self.assertIn('all workers are stopped', stderr)
self.assertIn(b'all workers are stopped', stderr)
self.assertEqual(3, process.poll())

def test_broken(self):
Expand Down

0 comments on commit 1d7d016

Please sign in to comment.