Files
lmxopcua/scripts/validation/grpc-data/LOCAL_FIXTURES.md
T
2026-11-23 09:55:04 -05:00

105 lines
6.1 KiB
Markdown

# Local whole-solution prerequisites
The explicit local mode of `scripts/ci/integration-fixtures.sh` dispatches to
`local_fixtures.py` before the legacy CI helper reads defaults or performs cleanup.
It never starts any existing Compose stack. Existing fixture Dockerfiles, seeded
SQL/configuration files and JSON-array service commands are reused as inputs.
The final coordinator runs the fake Docker ownership tests before actual startup:
```bash
python3 -m unittest discover -s scripts/validation/grpc-data/tests -p test_fixture_ownership.py
```
Use a fresh suffix and absolute output file for every run. The final runner passes
these variables directly to the helper; printed output must never be evaluated.
```bash
CI_FIXTURE_LOCAL_OWNED=1 \
CI_FIXTURE_SUFFIX=grpc-data-final-unique \
CI_FIXTURE_ENV_JSON=/absolute/private/run/fixture-environment.json \
FIXTURE_HOST=127.0.0.1 \
bash scripts/ci/integration-fixtures.sh up
```
Startup writes a JSON dictionary of test environment variables at the requested
path with mode `0600`. The ownership journal is that path plus `.manifest.json`;
the private directory for logs, generated certificates and profile environment
dictionaries is that path plus `.d` (`0700`). Standard output contains only a
redacted status and the environment output path. Credentials are randomly
generated for this run. The ordinary SQL fixture is separate from the SQL
blackhole fixture and from the P10 rig's SQL instance.
The default service set includes SQL Server, PostgreSQL, MySQL, Oracle Free,
QuestDB, ordinary and NAT opc-plc, GLAuth, python-snap7, FOCAS mock, the MTConnect
agent and SHDR adapter, authenticated TLS/plain Mosquitto and its retained JSON
publisher, all six Modbus profiles and all seven AB CIP/PCCC family profiles.
SQL Server and Oracle run as `linux/amd64` when emulation is needed. Images built
from repository Dockerfiles receive unique run labels and image IDs. Published
images pulled as dependencies are retained in the ordinary image cache.
Each run creates its own labelled Docker bridge. Every published port binds to
`127.0.0.1`. Docker allocates host ports; ordinary
opc-plc uses a candidate allocated locally for both advertised and published port.
Docker bind failures fail startup without removing a pre-existing resource.
Container creation intent and immutable ID are journaled before start, so a
failed start or interrupted setup can be cleaned up by the same run.
Run `down` with the same four inputs after success or failed setup. Cleanup first
validates the entire recorded inventory against the current local Docker context
and exact owner/project/creation-instance labels. It then removes only the
recorded IDs, rechecking immediately before removal. Pending creation records are
recovered by exact name lookup, followed by ownership and ID validation; names
are never deletion targets. Daemon errors are not treated as absent resources.
The helper never uses Compose down, wildcard deletion, global prune or an
unverified container name. Private evidence and secrets remain restricted for
the coordinator to retain or dispose of under its run directory policy.
`logs` uses the same manifest and writes bounded container-log tails into the
private command logs. Each subprocess has a duration/output bound. A failure
prints no captured output or command arguments; inspect the private logs locally.
The base environment enables standard Modbus plus RTU, ControlLogix, and all
three PCCC families through their explicit per-family ports. Other Modbus and AB
CIP profile environments are written to `.d/profile-environments.json`. After
the unfiltered full-solution command, the coordinator runs the corresponding
integration project with each profile environment. Every AB overlay retains the
same owned ControlLogix companion endpoint for tests authored for ControlLogix.
The variant smoke tests dial the selected CompactLogix, Micro800 or GuardLogix
endpoint. The runner validates both literal loopback endpoints and requires
distinct ports across the four simulators. The read-only differential runs
against ControlLogix with the general write fixtures closed.
The process-wide SDK lifecycle diagnostic runs its exact 90-second case in a
fresh test process. Its discovery, TRX and diagnostic JSONL are included in the
final result inventory. The unfiltered run still executes the folder-event
performance tests and the short saturation-observer protocol controls. A
profile-specific skip counts as coverage only when its matching test ran. `CI_FIXTURE_SERVICES` can
select a comma-separated subset for focused fixture diagnosis; a subset is not
the whole-solution prerequisites gate.
Generated S7 pause/restart commands and SQL blackhole controls use the same
helper's `control` action. It revalidates local context, restricted manifest,
recorded service ID and ownership labels before each verb. The local Host probe
tests require `HOST_PROBE_OPCUA_ENDPOINT` from the P10 rig's actual OtOpcUa OPC
listener. No proprietary Galaxy gateway is substituted by another protocol;
its exact live test remains explicitly unavailable when no local backend exists.
Refresh `fixture-environment-map.json` with `python3
scripts/validation/grpc-data/fixture_inventory.py` after the candidate changes.
This source inventory includes every test project, linked source, category and
environment switch. Discovery/TRX is still required for concrete theory names,
per-assembly execution, every skip reason and the final availability decision.
ODBC host drivers and the built ScriptWorker are software prerequisites to
verify separately. The map lists explicit Windows/native/proprietary/live
requirements and long-running opt-in decisions; source presence never proves
execution.
When the coordinator has installed a compatible native PostgreSQL ODBC driver,
pass its existing absolute library path as `CI_FIXTURE_ODBC_DRIVER` during `up`.
The helper validates that input and writes `SQL_ODBC_CONNECTION_STRING` using
only this run's seeded PostgreSQL endpoint and generated credentials. It never
inherits an ODBC connection string or uses a driver registration that could hide
an external endpoint. The coordinator still verifies the native driver manager
and .NET ODBC runtime through the applicable tests.