|
@@ -510,3 +510,35 @@ class ProjectTest(unittest.TestCase):
|
|
|
|
|
|
project.down(ImageType.all, True)
|
|
project.down(ImageType.all, True)
|
|
self.mock_client.remove_image.assert_called_once_with("busybox:latest")
|
|
self.mock_client.remove_image.assert_called_once_with("busybox:latest")
|
|
|
|
+
|
|
|
|
+ def test_warning_in_swarm_mode(self):
|
|
|
|
+ self.mock_client.info.return_value = {'Swarm': {'LocalNodeState': 'active'}}
|
|
|
|
+ project = Project('composetest', [], self.mock_client)
|
|
|
|
+
|
|
|
|
+ with mock.patch('compose.project.log') as fake_log:
|
|
|
|
+ project.up()
|
|
|
|
+ assert fake_log.warn.call_count == 1
|
|
|
|
+
|
|
|
|
+ def test_no_warning_on_stop(self):
|
|
|
|
+ self.mock_client.info.return_value = {'Swarm': {'LocalNodeState': 'active'}}
|
|
|
|
+ project = Project('composetest', [], self.mock_client)
|
|
|
|
+
|
|
|
|
+ with mock.patch('compose.project.log') as fake_log:
|
|
|
|
+ project.stop()
|
|
|
|
+ assert fake_log.warn.call_count == 0
|
|
|
|
+
|
|
|
|
+ def test_no_warning_in_normal_mode(self):
|
|
|
|
+ self.mock_client.info.return_value = {'Swarm': {'LocalNodeState': 'inactive'}}
|
|
|
|
+ project = Project('composetest', [], self.mock_client)
|
|
|
|
+
|
|
|
|
+ with mock.patch('compose.project.log') as fake_log:
|
|
|
|
+ project.up()
|
|
|
|
+ assert fake_log.warn.call_count == 0
|
|
|
|
+
|
|
|
|
+ def test_no_warning_with_no_swarm_info(self):
|
|
|
|
+ self.mock_client.info.return_value = {}
|
|
|
|
+ project = Project('composetest', [], self.mock_client)
|
|
|
|
+
|
|
|
|
+ with mock.patch('compose.project.log') as fake_log:
|
|
|
|
+ project.up()
|
|
|
|
+ assert fake_log.warn.call_count == 0
|