Skip to content

Commit 8bc3226

Browse files
committed
tests: Add a test for the unknown status
1 parent 944771d commit 8bc3226

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

batchspawner/tests/test_spawners.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

164179
def test_templates(db, io_loop):
165180
"""Test templates in the run_command commands"""

0 commit comments

Comments
 (0)