From a423d44dda1c6858635a880a15c74ff1047feace Mon Sep 17 00:00:00 2001 From: jeanluciano Date: Mon, 3 Feb 2025 11:42:06 -0600 Subject: [PATCH 1/2] adds description --- src/prefect/events/schemas/automations.py | 2 +- tests/cli/test_deploy.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/prefect/events/schemas/automations.py b/src/prefect/events/schemas/automations.py index 2eeea40214c6..c3e0a0cc6ae8 100644 --- a/src/prefect/events/schemas/automations.py +++ b/src/prefect/events/schemas/automations.py @@ -84,7 +84,7 @@ def as_automation(self) -> "AutomationCore": getattr(self, "name", None) or f"Automation for deployment {self._deployment_id}" ), - description="", + description=getattr(self, "description", ""), enabled=getattr(self, "enabled", True), trigger=trigger, actions=self.actions(), diff --git a/tests/cli/test_deploy.py b/tests/cli/test_deploy.py index 361cbbc56b84..a6ec9de4d57c 100644 --- a/tests/cli/test_deploy.py +++ b/tests/cli/test_deploy.py @@ -5532,6 +5532,7 @@ async def test_initialize_named_deployment_triggers(self): trigger_spec = { "name": "Trigger McTriggerson", "enabled": True, + "description": "This is a test trigger", "match": {"prefect.resource.id": "prefect.flow-run.*"}, "expect": ["prefect.flow-run.Completed"], "match_related": { @@ -5546,7 +5547,7 @@ async def test_initialize_named_deployment_triggers(self): DeploymentEventTrigger( **{ "name": "Trigger McTriggerson", - "description": "", + "description": "This is a test trigger", "enabled": True, "match": {"prefect.resource.id": "prefect.flow-run.*"}, "match_related": { From 48396d49804d7ea56aaa9077f86375a3400725ad Mon Sep 17 00:00:00 2001 From: jeanluciano Date: Tue, 4 Feb 2025 13:31:30 -0600 Subject: [PATCH 2/2] updates rest of test to check for description --- tests/cli/test_deploy.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/cli/test_deploy.py b/tests/cli/test_deploy.py index a6ec9de4d57c..c49a6939d413 100644 --- a/tests/cli/test_deploy.py +++ b/tests/cli/test_deploy.py @@ -5737,6 +5737,7 @@ async def test_json_string_trigger(self, docker_work_pool): trigger_spec = { "enabled": True, + "description": "This is a test trigger", "match": {"prefect.resource.id": "prefect.flow-run.*"}, "expect": ["prefect.flow-run.Completed"], "job_variables": {"foo": "bar"}, @@ -5776,6 +5777,7 @@ async def test_json_file_trigger(self, docker_work_pool): trigger_spec = { "enabled": True, + "description": "This is a test trigger", "match": {"prefect.resource.id": "prefect.flow-run.*"}, "expect": ["prefect.flow-run.Completed"], "job_variables": {"foo": "bar"}, @@ -5816,6 +5818,7 @@ async def test_yaml_file_trigger(self, docker_work_pool): trigger_spec = { "enabled": True, + "description": "This is a test trigger", "match": {"prefect.resource.id": "prefect.flow-run.*"}, "expect": ["prefect.flow-run.Completed"], "job_variables": {"foo": "bar"}, @@ -5856,6 +5859,7 @@ async def test_nested_yaml_file_trigger(self, docker_work_pool, tmpdir): trigger_spec = { "enabled": True, + "description": "This is a test trigger", "match": {"prefect.resource.id": "prefect.flow-run.*"}, "expect": ["prefect.flow-run.Completed"], }