Cancel shutdown when crashed worker is restarted (#813)
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
This commit is contained in:
1
changelog/813.bugfix
Normal file
1
changelog/813.bugfix
Normal file
@@ -0,0 +1 @@
|
|||||||
|
Cancel shutdown when a crashed worker is restarted.
|
||||||
@@ -225,6 +225,7 @@ class DSession:
|
|||||||
self.triggershutdown()
|
self.triggershutdown()
|
||||||
else:
|
else:
|
||||||
self.report_line("\nreplacing crashed worker %s" % node.gateway.id)
|
self.report_line("\nreplacing crashed worker %s" % node.gateway.id)
|
||||||
|
self.shuttingdown = False
|
||||||
self._clone_node(node)
|
self._clone_node(node)
|
||||||
self._active_nodes.remove(node)
|
self._active_nodes.remove(node)
|
||||||
|
|
||||||
|
|||||||
@@ -94,3 +94,28 @@ class TestCrashItem:
|
|||||||
res = pytester.runpytest("-n2", "-s")
|
res = pytester.runpytest("-n2", "-s")
|
||||||
res.stdout.fnmatch_lines_random(["*HOOK: pytest_handlecrashitem"])
|
res.stdout.fnmatch_lines_random(["*HOOK: pytest_handlecrashitem"])
|
||||||
res.stdout.fnmatch_lines(["*3 passed*"])
|
res.stdout.fnmatch_lines(["*3 passed*"])
|
||||||
|
|
||||||
|
def test_handlecrashitem_one(self, pytester: pytest.Pytester) -> None:
|
||||||
|
"""Test pytest_handlecrashitem hook with just one test."""
|
||||||
|
pytester.makeconftest(
|
||||||
|
"""
|
||||||
|
test_runs = 0
|
||||||
|
|
||||||
|
def pytest_handlecrashitem(crashitem, report, sched):
|
||||||
|
global test_runs
|
||||||
|
|
||||||
|
if test_runs == 0:
|
||||||
|
sched.mark_test_pending(crashitem)
|
||||||
|
test_runs = 1
|
||||||
|
else:
|
||||||
|
print("HOOK: pytest_handlecrashitem")
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
res = pytester.runpytest("-n1", "-s", "-k", "test_b")
|
||||||
|
res.stdout.fnmatch_lines_random(["*HOOK: pytest_handlecrashitem"])
|
||||||
|
res.stdout.fnmatch_lines(
|
||||||
|
[
|
||||||
|
"FAILED test_handlecrashitem_one.py::test_b",
|
||||||
|
"FAILED test_handlecrashitem_one.py::test_b",
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user