@@ -28,6 +28,7 @@ class BatchDummy(BatchSpawnerRegexStates):
2828 state_pending_re = Unicode ('PEND' )
2929 state_running_re = Unicode ('RUN' )
3030 state_exechost_re = Unicode ('RUN (.*)$' )
31+ state_unknown_re = Unicode ('UNKNOWN' )
3132
3233 cmd_expectlist = None
3334 out_expectlist = None
@@ -160,6 +161,20 @@ def test_poll_fails(db, io_loop):
160161 assert spawner .job_id == ''
161162 assert spawner .job_status == ''
162163
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+
163178
164179def test_templates (db , io_loop ):
165180 """Test templates in the run_command commands"""
0 commit comments