- device: read-only scale block (holding registers 1000..5095) + scale_set control action - seed: GRPC_DATA_SCALE=N adds SOURCE driver modscale/dev with N UInt16 tags in TagGroups small (first 160) / large (rest), one RawTagGroup export + CONSUMER mapping each (map-scale-small|large); fixture.json records the counts - rig.py: seed --scale N; deploy trigger gets a 60 s socket timeout (the AdminUI's StartDeployment ask waits up to 45 s; a 2048-tag snapshot read took ~25 s, so the general 15 s cap aborted the POST) - scale_gate.py: opens a >128 and a >1024-item mapping via Client CLI recursive subscribes on CONSUMER, requires all Good, churns the block, restarts the SOURCE pair, requires all Good with a post-restart value, checks the consumer ResetHistory counter and the container logs for 'history expired'; PASS/FAIL + evidence/S1026-results.json Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -80,6 +80,21 @@ class ModbusFixtureTests(unittest.TestCase):
|
||||
apply_control(self.state, command)
|
||||
self.assertEqual(self.state.snapshot()["effect_total"], 0)
|
||||
|
||||
def test_scale_block_is_read_only_and_set_as_one_value(self):
|
||||
# #1115: 4096 contiguous read-only registers from 1000; one control action sets them all.
|
||||
self.assertEqual(words(handle_modbus_pdu(self.state, 1, request(3, 1000, 125))), (1,) * 125)
|
||||
self.assertEqual(words(handle_modbus_pdu(self.state, 1, request(3, 5095 - 124, 125))), (1,) * 125)
|
||||
self.assertEqual(handle_modbus_pdu(self.state, 1, request(3, 5096, 1)), b"\x83\x02")
|
||||
self.assertEqual(handle_modbus_pdu(self.state, 1, request(3, 999, 2)), b"\x83\x02")
|
||||
self.assertEqual(handle_modbus_pdu(self.state, 1, request(6, 1000, 5)), b"\x86\x02")
|
||||
apply_control(self.state, {"action": "scale_set", "value": 4242})
|
||||
self.assertEqual(words(handle_modbus_pdu(self.state, 1, request(3, 2047, 3))), (4242,) * 3)
|
||||
self.assertEqual(self.state.snapshot()["scale"], {"base": 1000, "count": 4096, "value": 4242, "sets": 1})
|
||||
for invalid in (-1, 65536, "1", None):
|
||||
with self.assertRaises(ValueError):
|
||||
apply_control(self.state, {"action": "scale_set", "value": invalid})
|
||||
self.assertEqual(self.state.snapshot()["effect_total"], 0)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user