Add flag for stops all containers if any container was stopped.

Signed-off-by: Evgeniy Dobrohvalov <scipetr@gmail.com>
This commit is contained in:
Evgeniy Dobrohvalov 2015-10-02 20:07:44 +03:00
commit bf48a781db
6 changed files with 68 additions and 33 deletions

View file

@ -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())))