Add durable workflow triggers and waits

This commit is contained in:
2026-08-01 20:57:26 +02:00
parent 55f98d1b65
commit a1cea1d162
12 changed files with 2213 additions and 275 deletions
+18 -15
View File
@@ -29,7 +29,7 @@ class WorkflowMigrationTests(unittest.TestCase):
try:
with engine.connect() as connection:
self.assertIn(
"0b4e7c9a2d6f",
"b2e4f6a8c0d1",
set(MigrationContext.configure(connection).get_current_heads()),
)
self.assertEqual(
@@ -39,6 +39,9 @@ class WorkflowMigrationTests(unittest.TestCase):
"workflow_instance_events",
"workflow_instance_steps",
"workflow_instances",
"workflow_triggers",
"workflow_trigger_deliveries",
"workflow_wait_states",
},
{
name
@@ -98,7 +101,7 @@ class WorkflowMigrationTests(unittest.TestCase):
engine_manifest.migration_spec.script_location or ""
)
for path in current_revisions.glob("*.py"):
if path.name.startswith("0b4e7c9a2d6f_"):
if path.name.startswith(("0b4e7c9a2d6f_", "b2e4f6a8c0d1_")):
continue
shutil.copy2(path, legacy_revisions / path.name)
legacy_manifest = replace(
@@ -123,19 +126,13 @@ class WorkflowMigrationTests(unittest.TestCase):
with engine.connect() as connection:
self.assertIn(
"f1b7d3e5a9c2",
set(
MigrationContext.configure(
connection
).get_current_heads()
),
set(MigrationContext.configure(connection).get_current_heads()),
)
self.assertNotIn(
"standard_origin_module_id",
{
item["name"]
for item in inspect(engine).get_columns(
"workflow_definitions"
)
for item in inspect(engine).get_columns("workflow_definitions")
},
)
finally:
@@ -147,17 +144,23 @@ class WorkflowMigrationTests(unittest.TestCase):
manifest_factories=(get_manifest,),
)
self.assertIn("0b4e7c9a2d6f", result.current_revision or "")
self.assertIn("b2e4f6a8c0d1", result.current_revision or "")
engine = create_engine(url)
try:
self.assertEqual(first_tables, set(inspect(engine).get_table_names()))
upgraded_tables = set(inspect(engine).get_table_names())
self.assertTrue(first_tables.issubset(upgraded_tables))
self.assertTrue(
{
"workflow_triggers",
"workflow_trigger_deliveries",
"workflow_wait_states",
}.issubset(upgraded_tables)
)
self.assertIn(
"standard_origin_module_id",
{
item["name"]
for item in inspect(engine).get_columns(
"workflow_definitions"
)
for item in inspect(engine).get_columns("workflow_definitions")
},
)
finally: