From 00fb6b56a92f7f9813173bb5883439ea830948fa Mon Sep 17 00:00:00 2001 From: Albrecht Degering Date: Mon, 3 Aug 2026 07:40:53 +0200 Subject: [PATCH] Restore workflow facade recovery tests --- tests/test_instance_service.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tests/test_instance_service.py b/tests/test_instance_service.py index 70cac98..384e2c0 100644 --- a/tests/test_instance_service.py +++ b/tests/test_instance_service.py @@ -24,6 +24,12 @@ from govoplan_core.core.dataflows import ( CAPABILITY_DATAFLOW_RUN_LIFECYCLE, DataflowRunDescriptor, ) +from govoplan_core.core.recovery import RecoveryCheckpoint, RecoveryOperation +from govoplan_core.core.runtime_coordination import ( + DistributedLease, + RuntimeIdentity, + bind_process_runtime_identity, +) from govoplan_core.db.base import Base from govoplan_workflow.backend.db.models import ( WorkflowDefinition, @@ -87,6 +93,17 @@ def principal() -> ApiPrincipal: ) +def runtime_identity() -> RuntimeIdentity: + return RuntimeIdentity( + installation_id="workflow-compatibility-tests", + node_id="workflow-worker", + incarnation="workflow-worker-incarnation", + role="worker", + software_version="test", + composition_hash="c" * 64, + ) + + def runtime_graph() -> WorkflowGraph: return WorkflowGraph( nodes=[ @@ -385,6 +402,9 @@ class WorkflowInstanceServiceTests(unittest.TestCase): Base.metadata.create_all( self.engine, tables=[ + DistributedLease.__table__, + RecoveryOperation.__table__, + RecoveryCheckpoint.__table__, WorkflowDefinition.__table__, WorkflowDefinitionRevision.__table__, WorkflowInstance.__table__, @@ -397,6 +417,7 @@ class WorkflowInstanceServiceTests(unittest.TestCase): ) self.Session = sessionmaker(bind=self.engine) self.session: Session = self.Session() + bind_process_runtime_identity(runtime_identity()) self.dataflow = FakeDataflowLifecycle() self.registry = Registry(self.dataflow) self.definition = create_definition( @@ -421,6 +442,7 @@ class WorkflowInstanceServiceTests(unittest.TestCase): self.session.commit() def tearDown(self) -> None: + bind_process_runtime_identity(None) self.session.close() Base.metadata.drop_all( self.engine, @@ -433,6 +455,9 @@ class WorkflowInstanceServiceTests(unittest.TestCase): WorkflowTrigger.__table__, WorkflowDefinitionRevision.__table__, WorkflowDefinition.__table__, + RecoveryCheckpoint.__table__, + RecoveryOperation.__table__, + DistributedLease.__table__, ], ) self.engine.dispose()