Add flag for stops all containers if any container was stopped.
Signed-off-by: Evgeniy Dobrohvalov <scipetr@gmail.com>
This commit is contained in:
parent
ad8faad296
commit
bf48a781db
6 changed files with 68 additions and 33 deletions
|
|
@ -36,7 +36,7 @@ class CLIMainTestCase(unittest.TestCase):
|
|||
mock_container('another', 1),
|
||||
]
|
||||
service_names = ['web', 'db']
|
||||
log_printer = build_log_printer(containers, service_names, True)
|
||||
log_printer = build_log_printer(containers, service_names, True, False)
|
||||
self.assertEqual(log_printer.containers, containers[:3])
|
||||
|
||||
def test_build_log_printer_all_services(self):
|
||||
|
|
@ -46,7 +46,7 @@ class CLIMainTestCase(unittest.TestCase):
|
|||
mock_container('other', 1),
|
||||
]
|
||||
service_names = []
|
||||
log_printer = build_log_printer(containers, service_names, True)
|
||||
log_printer = build_log_printer(containers, service_names, True, False)
|
||||
self.assertEqual(log_printer.containers, containers)
|
||||
|
||||
def test_attach_to_logs(self):
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ from __future__ import absolute_import
|
|||
from __future__ import unicode_literals
|
||||
|
||||
import unittest
|
||||
from time import sleep
|
||||
|
||||
from compose.cli.multiplexer import Multiplexer
|
||||
|
||||
|
|
@ -46,3 +47,20 @@ class MultiplexerTest(unittest.TestCase):
|
|||
|
||||
with self.assertRaises(Problem):
|
||||
list(mux.loop())
|
||||
|
||||
def test_cascade_stop(self):
|
||||
mux = Multiplexer([
|
||||
((lambda x: sleep(0.01) or x)(x) for x in ['after 0.01 sec T1',
|
||||
'after 0.02 sec T1',
|
||||
'after 0.03 sec T1']),
|
||||
((lambda x: sleep(0.02) or x)(x) for x in ['after 0.02 sec T2',
|
||||
'after 0.04 sec T2',
|
||||
'after 0.06 sec T2']),
|
||||
], cascade_stop=True)
|
||||
|
||||
self.assertEqual(
|
||||
['after 0.01 sec T1',
|
||||
'after 0.02 sec T1',
|
||||
'after 0.02 sec T2',
|
||||
'after 0.03 sec T1'],
|
||||
sorted(list(mux.loop())))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue