@@ -80,7 +80,7 @@ def debug_logging():
80
80
81
81
82
82
@pytest .mark .asyncio
83
- async def test_restart_check (config , install_kernel ):
83
+ async def test_restart_check (config , install_kernel , debug_logging ):
84
84
"""Test that the kernel is restarted and recovers"""
85
85
# If this test failes, run it with --log-cli-level=DEBUG to inspect
86
86
N_restarts = 1
@@ -116,6 +116,15 @@ def cb():
116
116
# Kill without cleanup to simulate crash:
117
117
await km .provisioner .kill ()
118
118
await restarts [i ]
119
+ # Wait for kill + restart
120
+ max_wait = 10.0
121
+ waited = 0.0
122
+ while waited < max_wait and km .is_alive ():
123
+ await asyncio .sleep (0.1 )
124
+ waited += 0.1
125
+ while waited < max_wait and not km .is_alive ():
126
+ await asyncio .sleep (0.1 )
127
+ waited += 0.1
119
128
120
129
assert cbs == N_restarts
121
130
assert km .is_alive ()
@@ -127,7 +136,7 @@ def cb():
127
136
128
137
129
138
@pytest .mark .asyncio
130
- async def test_restarter_gives_up (config , install_fail_kernel ):
139
+ async def test_restarter_gives_up (config , install_fail_kernel , debug_logging ):
131
140
"""Test that the restarter gives up after reaching the restart limit"""
132
141
# If this test failes, run it with --log-cli-level=DEBUG to inspect
133
142
N_restarts = 1
@@ -173,7 +182,7 @@ def on_death():
173
182
174
183
175
184
@pytest .mark .asyncio
176
- async def test_async_restart_check (config , install_kernel ):
185
+ async def test_async_restart_check (config , install_kernel , debug_logging ):
177
186
"""Test that the kernel is restarted and recovers"""
178
187
# If this test failes, run it with --log-cli-level=DEBUG to inspect
179
188
N_restarts = 1
@@ -209,6 +218,15 @@ def cb():
209
218
# Kill without cleanup to simulate crash:
210
219
await km .provisioner .kill ()
211
220
await restarts [i ]
221
+ # Wait for kill + restart
222
+ max_wait = 10.0
223
+ waited = 0.0
224
+ while waited < max_wait and await km .is_alive ():
225
+ await asyncio .sleep (0.1 )
226
+ waited += 0.1
227
+ while waited < max_wait and not await km .is_alive ():
228
+ await asyncio .sleep (0.1 )
229
+ waited += 0.1
212
230
213
231
assert cbs == N_restarts
214
232
assert await km .is_alive ()
@@ -220,7 +238,7 @@ def cb():
220
238
221
239
222
240
@pytest .mark .asyncio
223
- async def test_async_restarter_gives_up (config , install_slow_fail_kernel ):
241
+ async def test_async_restarter_gives_up (config , install_slow_fail_kernel , debug_logging ):
224
242
"""Test that the restarter gives up after reaching the restart limit"""
225
243
# If this test failes, run it with --log-cli-level=DEBUG to inspect
226
244
N_restarts = 2
0 commit comments