Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
allgo
allgo
Commits
96d94c21
Commit
96d94c21
authored
Nov 15, 2017
by
BAIRE Anthony
Browse files
fix race conditions
parent
ade01774
Changes
1
Show whitespace changes
Inline
Side-by-side
controller/test_controller.py
View file @
96d94c21
...
...
@@ -1628,6 +1628,7 @@ class ManagerTestCase(unittest.TestCase):
conditions
[
id
].
wait
()
actual_lst
.
append
((
"stop"
,
id
))
@
asyncio
.
coroutine
def
_process
(
id
,
reset
,
rescheduled
):
with
lock
:
self
.
assertNotIn
(
id
,
conditions
)
...
...
@@ -1917,9 +1918,9 @@ class ManagerTestCase(unittest.TestCase):
rescheduled
[
id
]
=
rsc_fut
return
fut
.
result
()
manager
=
controller
.
Manager
(
2
)
manager
.
_process
=
lambda
*
k
:
manager
.
run_in_executor
(
worker
,
*
k
)
manager
.
_process
=
asyncio
.
coroutine
(
lambda
*
k
:
manager
.
run_in_executor
(
worker
,
*
k
))
@
asyncio
.
coroutine
...
...
@@ -1957,6 +1958,8 @@ class ManagerTestCase(unittest.TestCase):
yield
from
asyncio
.
wait_for
(
fut
,
timeout
=
.
1
)
self
.
assertEquals
(
fut
.
result
(),
43
)
self
.
assertFalse
(
fut2
.
done
())
yield
from
asyncio
.
sleep
(.
1
)
# since the task is restarted, the 'rescheduled' is recreated
self
.
assertFalse
(
rescheduled
[
2
].
done
())
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment