test: model modbus refusals and request accounting in grpc fixture
This commit is contained in:
@@ -48,8 +48,16 @@ endpoint or another node's OPC UA endpoint as its source driver.
|
||||
on container port 5020. Holding register 0 is a counter changed only by the
|
||||
fixture control action `{"action":"advance","steps":N}` (1–1000). Registers
|
||||
10–12 start at `[7, 11, 13]`; registers 20–63 are writable uint16 values.
|
||||
FC03/FC04 reads and FC06/FC16 writes are supported. Read requests and committed
|
||||
writes have separate bounded ledgers with monotonic totals. The HTTP control
|
||||
FC03/FC04 reads and FC06/FC16 writes are supported. Unmapped spans return
|
||||
exception 02, malformed values/counts return 03, and unsupported functions
|
||||
(including FC23) return 01 so callers can retry using FC16. The fixture's
|
||||
unknown-unit policy returns target-unavailable exception 0B with the unit echoed.
|
||||
Validly framed refusals keep the stream open; invalid MBAP framing closes it.
|
||||
Total requests, read attempts (including refusals), rejected writes, and committed
|
||||
effects have separate bounded ledgers with monotonic totals. Records contain
|
||||
structural numeric metadata and bounded fixture write values, never raw payloads.
|
||||
Invalid/truncated frames count as requests; clean stream EOF does not. Read and
|
||||
rejected-write records share the total-request sequence. The HTTP control
|
||||
listener on container port 8080 offers `GET /state` and `POST /control`, with
|
||||
`advance`, bounded `set`, and `drop_next_write_response` actions. The last
|
||||
action closes one Modbus write connection after applying and recording the
|
||||
@@ -57,5 +65,7 @@ effect, so D08 can distinguish an ambiguous response from a second effect.
|
||||
The control listener is fixture-only and its allocated host port is loopback
|
||||
bound; it must never be wired into the production Host.
|
||||
|
||||
Unit tests in `tests/test_device.py` and `tests/test_compose_fixture.py` are
|
||||
pure. They do not start a socket, container, migration, or network client.
|
||||
Unit tests in `tests/test_device.py`, `tests/test_device_wire.py`, and
|
||||
`tests/test_compose_fixture.py` are pure. The wire tests drive the actual handler
|
||||
through memory streams. They do not start a socket, container, migration, or
|
||||
network client.
|
||||
|
||||
Reference in New Issue
Block a user