test(grpc-data): H3 live gate harness (H01-H06, SqlServer and QuestDB origins)
rig.py up --history --history-backend questdb adds a run-owned QuestDB for the SOURCE historian. History seed profile: mappings grant HistoryRead, the CLI principal's CONSUMER HistoryRead comes only from mapping-scoped grants, text is historized (per-type aggregate refusal), new acl_permissions mutation. history_gate.py drives H01-H06 through the Client CLI on projected NodeIds resolved by browse from the mapping anchor, compares with the origin, and restores the baseline after every scenario. The node probe reports the origin's open history continuations (LocalDataServices.HistoryOpenContinuations, now public).
This commit is contained in:
@@ -473,7 +473,9 @@ def require_production_prerequisites(action, available):
|
||||
ROOT = Path(__file__).resolve().parents[3]
|
||||
HERE = Path(__file__).resolve().parent
|
||||
NODES = tuple(f"{pair}-{n}" for pair in ("control", "source", "consumer") for n in (1, 2))
|
||||
SERVICES = ("sql", "migrator", "device", "seeder", *NODES)
|
||||
# `questdb` exists only on a `--history-backend questdb` run (compose.history.questdb.yml); listing it is the DNS allowlist.
|
||||
SERVICES = ("sql", "migrator", "device", "seeder", "questdb", *NODES)
|
||||
HISTORY_BACKENDS = ("sqlserver", "questdb")
|
||||
|
||||
|
||||
def run_command(argv, *, timeout=120, environment=None):
|
||||
@@ -671,6 +673,8 @@ class LocalRig:
|
||||
files = ["--file", str(HERE / "compose.yml")]
|
||||
if self.environment.get("GRPC_DATA_HISTORY") == "1":
|
||||
files.extend(["--file", str(HERE / "compose.history.yml")])
|
||||
if self.environment.get("GRPC_DATA_HISTORY_BACKEND") == "questdb":
|
||||
files.extend(["--file", str(HERE / "compose.history.questdb.yml")])
|
||||
return files
|
||||
|
||||
def compose(self, *args, timeout=120):
|
||||
@@ -841,7 +845,7 @@ class LocalRig:
|
||||
self.save(manifest)
|
||||
return manifest
|
||||
|
||||
def up(self, timeout=600, history=False):
|
||||
def up(self, timeout=600, history=False, history_backend="sqlserver"):
|
||||
import secrets
|
||||
import credentials
|
||||
if self.folder.exists():
|
||||
@@ -862,7 +866,10 @@ class LocalRig:
|
||||
import base64
|
||||
settings["GRPC_DATA_SECRETS_KEK"] = base64.b64encode(secrets.token_bytes(32)).decode()
|
||||
if history:
|
||||
if history_backend not in HISTORY_BACKENDS:
|
||||
raise RigError("unknown history backend")
|
||||
settings["GRPC_DATA_HISTORY"] = "1"
|
||||
settings["GRPC_DATA_HISTORY_BACKEND"] = history_backend
|
||||
atomic_write_secret(self.folder / "environment.json", json.dumps(settings))
|
||||
self.environment.update(settings)
|
||||
credentials.provision_tls(self.folder / "security", NODES[2:])
|
||||
@@ -1331,6 +1338,8 @@ def main(argv=None):
|
||||
parser.add_argument("--run-id")
|
||||
parser.add_argument("--timeout", type=float, default=None)
|
||||
parser.add_argument("--history", action="store_true", help="up only: add the H2 history overlay (SOURCE historian + history seed profile)")
|
||||
parser.add_argument("--history-backend", choices=HISTORY_BACKENDS, default=None,
|
||||
help="up --history only: the SOURCE historian backend (sqlserver = the run's SQL container, default; questdb = a run-owned QuestDB)")
|
||||
arguments = parser.parse_args(argv)
|
||||
try:
|
||||
if arguments.action == "preflight":
|
||||
@@ -1353,6 +1362,10 @@ def main(argv=None):
|
||||
if arguments.action != "up":
|
||||
raise RigError("--history applies to up only; the run remembers it")
|
||||
options["history"] = True
|
||||
if arguments.history_backend is not None:
|
||||
options["history_backend"] = arguments.history_backend
|
||||
elif arguments.history_backend is not None:
|
||||
raise RigError("--history-backend needs up --history")
|
||||
result = action(**options)
|
||||
print(json.dumps({"run_id": result["run_id"], "state": result.get("state"), "manifest": str(rig.path), "healthy": result.get("healthy")}))
|
||||
return 0
|
||||
|
||||
Reference in New Issue
Block a user