mirror of https://github.com/docker/compose.git
Fix flaky multiplex test.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
This commit is contained in:
parent
153185eadb
commit
6877c6ca06
|
@ -49,18 +49,13 @@ class MultiplexerTest(unittest.TestCase):
|
||||||
list(mux.loop())
|
list(mux.loop())
|
||||||
|
|
||||||
def test_cascade_stop(self):
|
def test_cascade_stop(self):
|
||||||
mux = Multiplexer([
|
def fast_stream():
|
||||||
((lambda x: sleep(0.01) or x)(x) for x in ['after 0.01 sec T1',
|
for num in range(3):
|
||||||
'after 0.02 sec T1',
|
yield "stream1 %s" % num
|
||||||
'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(
|
def slow_stream():
|
||||||
['after 0.01 sec T1',
|
sleep(5)
|
||||||
'after 0.02 sec T1',
|
yield "stream2 FAIL"
|
||||||
'after 0.02 sec T2',
|
|
||||||
'after 0.03 sec T1'],
|
mux = Multiplexer([fast_stream(), slow_stream()], cascade_stop=True)
|
||||||
sorted(list(mux.loop())))
|
assert "stream2 FAIL" not in set(mux.loop())
|
||||||
|
|
Loading…
Reference in New Issue