Merge pull request #2018 from dnephin/fix_scale_test

Handle unexpected errors, but don't ignore background threads
This commit is contained in:
Aanand Prasad 2015-09-11 15:42:01 -07:00
commit dbc68ca747
2 changed files with 19 additions and 13 deletions

View file

@ -638,8 +638,7 @@ class ServiceTest(DockerClientTestCase):
self.assertTrue(service.containers()[0].is_running)
self.assertIn("ERROR: for 2 Boom", mock_stdout.getvalue())
@mock.patch('sys.stdout', new_callable=StringIO)
def test_scale_with_api_returns_unexpected_exception(self, mock_stdout):
def test_scale_with_api_returns_unexpected_exception(self):
"""
Test that when scaling if the API returns an error, that is not of type
APIError, that error is re-raised.
@ -650,7 +649,8 @@ class ServiceTest(DockerClientTestCase):
with mock.patch(
'compose.container.Container.create',
side_effect=ValueError("BOOM")):
side_effect=ValueError("BOOM")
):
with self.assertRaises(ValueError):
service.scale(3)