test: scaffold isolated grpc data docker fixtures

This commit is contained in:
Joseph Doherty
2026-11-16 04:31:00 -05:00
parent 862dbc8e90
commit daea02b271
7 changed files with 747 additions and 0 deletions
+61
View File
@@ -0,0 +1,61 @@
# gRPC data local fixture scaffold
This directory contains the **preparation** for the P10 gate. The standalone
Compose file describes six Host processes in three independent two-node pairs:
CONTROL (admin and deployment), SOURCE, and CONSUMER. Each process has its own
LocalDb/secrets volume. SOURCE and CONSUMER have pair-local LocalDb replication.
The SQL Server and Modbus simulator are run-local services; exposed host ports
use Docker's dynamic allocation on `127.0.0.1`.
The fixture is **not ready for integration execution**. P07's dedicated TLS
listener, client trust options, target-issued credential provisioner, and
production seeding/deployment path are still in progress. The certificate
mounts reserve `/run/grpc-data/tls` on the four data nodes, but no guessed P07
option names or TLS activation are included. The existing `rig.py` currently
provides pure safety/polling boundaries, not `up`, `seed`, or `deploy` behavior.
The presence of this Compose file does not establish a healthy cluster, a
deployed catalog, or passing D01–D14 scenarios.
## Run-owned inputs for later rig integration
The future `rig.py up` must generate a restricted run directory and inject all
required Compose variables. `GRPC_DATA_PROJECT`, `GRPC_DATA_RUN_ID`,
`GRPC_DATA_IMAGE`, `GRPC_DATA_MIGRATOR_IMAGE`, and `GRPC_DATA_DEVICE_IMAGE` must
identify the run uniquely. `SOURCE_REVISION` must be the current source SHA,
including a dirty marker when applicable. `GRPC_DATA_CERT_DIR` must contain
per-node SAN certificates and private keys under `source-1`, `source-2`,
`consumer-1`, and `consumer-2`; their common trust material belongs in the same
restricted run directory. The rig must generate `GRPC_DATA_SQL_PASSWORD`,
`GRPC_DATA_APIKEY_PEPPER`, `GRPC_DATA_JWT_KEY`, `GRPC_DATA_DEPLOY_KEY`,
`GRPC_DATA_SECRETS_KEK`, `GRPC_DATA_CONFIG_KEY`, `GRPC_DATA_TELEMETRY_KEY`,
three `GRPC_DATA_MESH_PSK_*` values, and both `GRPC_DATA_SYNC_KEY_*` values.
None has a tracked default. The rig should pass them from a `0600` environment
file without writing values to logs or a public manifest.
The current Compose image build follows the repository's Host publish graph and
requires a nonempty `SourceRevisionId`. The future coordinator must build the
runtime and migrator images for the current checkout before starting nodes,
inspect Docker's allocated loopback ports, and record the exact run-owned
resource IDs and labels. A separate production-path seeder must create the
CONTROL/SOURCE/CONSUMER cluster rows, author source and mapping configuration,
provision every eligible consumer, and deploy through `/api/deployments` before
any readiness or CLI assertion is meaningful. No node should use a shared-host
endpoint or another node's OPC UA endpoint as its source driver.
## Device fixture
`device/server.py` uses the Python standard library. Modbus TCP unit 1 listens
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
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
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.