v3.22.4: the proactive-drain pending exemption
The runner's unexpected-pending-command guard fired for any non-expect step,
so a proactive-drain after a step that answered 91XX failed with
"unexpected proactive command pending (SW 91XX) - add an expect step or a
status action" - contradicting the drain's own doc ("consume whatever the
card announces") and the v3.22.2 RAM recipe ("an expect or a proactive-drain").
The guard now exempts a proactive-drain step: its STATUS poll re-announces
the unfetched command, fetches and answers it, and the drain's final-SW and
pending handling is unchanged (a still-pending card is handed to the next
step, an idle card passes). No pending-length plumbing: STATUS-first keeps
the drain's attempts/log semantics and tolerates a card that dropped the
command. The guard note now names the drain instead of the misleading
"status action" (a status action in that position also trips the guard).
Docs: the drain section in test-scripts.md, api.md's action list and the
help EN/RU drain bullet. Tests: 839 frontend + 819 Python; sw cache
simple-v408.
This commit is contained in:
@@ -744,6 +744,29 @@ class TestRunnerProactiveDrain(RunnerTestCase):
|
||||
self.assertEqual(entry['drained'][0]['qualifier'], '00')
|
||||
self.assertTrue(any('83020000' in a for a in scc.sent))
|
||||
|
||||
def test_a_drain_consumes_a_command_left_pending(self):
|
||||
# v3.22.4: the drain is exempt from the runner's pending guard - a
|
||||
# step that ended 91XX is consumed by the next drain (its STATUS poll
|
||||
# re-announces the unfetched command), no "unexpected pending" error.
|
||||
scc = FakeScc()
|
||||
scc.push('80F2', '', '9102') # the status step: pending
|
||||
scc.push('80F2', '', '9102') # the drain's first STATUS
|
||||
scc.push('8012', DISPLAY_TEXT_CMD, '9000')
|
||||
scc.push('8014', '', '9000')
|
||||
scc.push('80F2', '', '9000') # the drain's confirming STATUS
|
||||
run = self.run_script(FakeServer(scc), [
|
||||
{'type': 'action', 'kind': 'status', 'params': {'attempts': 2}},
|
||||
{'type': 'action', 'kind': 'proactive-drain',
|
||||
'params': {'attempts': 3, 'interval_ms': 0}},
|
||||
])
|
||||
self.assertEqual(run['status'], 'ok', run['steps'])
|
||||
self.assertEqual(len(run['steps']), 2)
|
||||
entry = run['steps'][1]
|
||||
self.assertEqual(entry['status'], 'ok')
|
||||
self.assertEqual(len(entry['drained']), 1)
|
||||
self.assertEqual(entry['drained'][0]['type_name'], 'DISPLAY TEXT')
|
||||
self.assertEqual(entry['sent'], 'STATUS x2; TR x1')
|
||||
|
||||
def test_require_matches_a_drained_command(self):
|
||||
scc = FakeScc()
|
||||
scc.push('80F2', '', '9102')
|
||||
|
||||
Reference in New Issue
Block a user