test(grpc-data): Gateway origin backend for the history rig — read-only AVEVA bindings, reverse/end-only H07, strict-ceiling H08 (#923)

This commit is contained in:
Joseph Doherty
2026-11-28 09:23:45 -05:00
parent 05f431f5d8
commit a6ae08146d
6 changed files with 316 additions and 15 deletions
@@ -551,6 +551,35 @@ class RuntimeCompositionTests(unittest.TestCase):
self.assertFalse(instance.health(row))
class HostGatewayEndpointTests(unittest.TestCase):
"""#923: a gateway-backend run may name the host-run HistorianGateway, under ServerHistorian__Endpoint only."""
def test_host_gateway_url_allowed_only_under_the_named_key(self):
row = {"ServerHistorian__Endpoint": "http://host.docker.internal:5231"}
rig.validate_fixture_endpoints(row, local_services={"source-1"}, host_gateway_keys={rig.GATEWAY_ENDPOINT_KEY})
# Positive control for the exception: without the key opt-in the same row is outside the allowlist.
with self.assertRaises(rig.RigError):
rig.validate_fixture_endpoints(row, local_services={"source-1"})
with self.assertRaises(rig.RigError):
rig.validate_fixture_endpoints({"Mesh__Endpoint": "http://host.docker.internal:5231"}, local_services={"source-1"},
host_gateway_keys={rig.GATEWAY_ENDPOINT_KEY})
def test_the_gateway_key_accepts_nothing_but_the_plain_host_alias_url(self):
for value in ["https://host.docker.internal:5231", "http://host.docker.internal", "http://10.100.0.48:5221",
"http://wonder-sql-vd03.zmr.zimmer.com:5221", "http://user:key@host.docker.internal:5231",
"http://host.docker.internal:5231/escape", "http://host.docker.internal:5231?k=v", "http://source-1:5231", ""]:
with self.subTest(value=value), self.assertRaises(rig.RigError):
rig.validate_fixture_endpoints({"ServerHistorian__Endpoint": value}, local_services={"source-1"},
host_gateway_keys={rig.GATEWAY_ENDPOINT_KEY})
def test_gateway_backend_overlay_layers_after_the_history_overlay(self):
instance = rig.LocalRig.__new__(rig.LocalRig)
instance.environment = {"GRPC_DATA_HISTORY": "1", "GRPC_DATA_HISTORY_BACKEND": "gateway"}
files = [f for f in instance.compose_files() if f != "--file"]
self.assertEqual([Path(f).name for f in files], ["compose.yml", "compose.history.yml", "compose.history.gateway.yml"])
self.assertIn("gateway", rig.HISTORY_BACKENDS)
class AkkaSeedEndpointTests(unittest.TestCase):
def test_named_akka_system_in_owned_seed_context_is_not_a_password(self):
rig.validate_fixture_endpoints({"Cluster__SeedNodes__0": "akka.tcp://otopcua@source-1:4053"}, local_services={"source-1"})