@@ -28,6 +28,7 @@ class BatchDummy(BatchSpawnerRegexStates):
28
28
state_pending_re = Unicode ('PEND' )
29
29
state_running_re = Unicode ('RUN' )
30
30
state_exechost_re = Unicode ('RUN (.*)$' )
31
+ state_unknown_re = Unicode ('UNKNOWN' )
31
32
32
33
cmd_expectlist = None
33
34
out_expectlist = None
@@ -160,6 +161,20 @@ def test_poll_fails(db, io_loop):
160
161
assert spawner .job_id == ''
161
162
assert spawner .job_status == ''
162
163
164
+ def test_unknown_status (db , io_loop ):
165
+ """Polling returns an unknown status"""
166
+ spawner = new_spawner (db = db )
167
+ assert spawner .get_state () == {}
168
+ # The start is successful:
169
+ io_loop .run_sync (spawner .start , timeout = 30 )
170
+ spawner .batch_query_cmd = 'echo UNKNOWN'
171
+ # This poll should not fail:
172
+ io_loop .run_sync (spawner .poll , timeout = 30 )
173
+ status = io_loop .run_sync (spawner .query_job_status , timeout = 30 )
174
+ assert status == JobStatus .UNKNOWN
175
+ assert spawner .job_id == '12345'
176
+ assert spawner .job_status != ''
177
+
163
178
164
179
def test_templates (db , io_loop ):
165
180
"""Test templates in the run_command commands"""
0 commit comments