@@ -1008,6 +1008,63 @@ async def test_workflows_can_use_default_versioning_behavior(
10081008 )
10091009
10101010
1011+ async def test_worker_deployment_config_without_versioning (
1012+ client : Client , env : WorkflowEnvironment
1013+ ):
1014+ if env .supports_time_skipping :
1015+ pytest .skip ("Test Server doesn't support worker deployments" )
1016+
1017+ build_id = "my-custom-build-id-1.0"
1018+ deployment_name = f"deployment-no-versioning-{ uuid .uuid4 ()} "
1019+
1020+ async with new_worker (
1021+ client ,
1022+ NoVersioningAnnotationWorkflow ,
1023+ deployment_config = WorkerDeploymentConfig (
1024+ version = WorkerDeploymentVersion (
1025+ deployment_name = deployment_name , build_id = build_id
1026+ ),
1027+ use_worker_versioning = False ,
1028+ ),
1029+ ) as worker :
1030+ handle = await client .start_workflow (
1031+ NoVersioningAnnotationWorkflow .run ,
1032+ id = f"no-versioning-build-id-{ uuid .uuid4 ()} " ,
1033+ task_queue = worker .task_queue ,
1034+ )
1035+ result = await handle .result ()
1036+ assert result == "whee"
1037+
1038+ history = await handle .fetch_history ()
1039+ assert any (
1040+ event .workflow_task_completed_event_attributes
1041+ and event .workflow_task_completed_event_attributes .worker_version
1042+ and event .workflow_task_completed_event_attributes .worker_version .build_id
1043+ == build_id
1044+ for event in history .events
1045+ ), "Expected build ID to appear in workflow history"
1046+
1047+
1048+ async def test_deployment_config_rejects_versioning_behavior_without_versioning (
1049+ client : Client ,
1050+ ):
1051+ with pytest .raises (
1052+ ValueError , match = "default_versioning_behavior must be UNSPECIFIED"
1053+ ):
1054+ Worker (
1055+ client ,
1056+ task_queue = f"task-queue-{ uuid .uuid4 ()} " ,
1057+ workflows = [NoVersioningAnnotationWorkflow ],
1058+ deployment_config = WorkerDeploymentConfig (
1059+ version = WorkerDeploymentVersion (
1060+ deployment_name = "whatever" , build_id = "1.0"
1061+ ),
1062+ use_worker_versioning = False ,
1063+ default_versioning_behavior = VersioningBehavior .AUTO_UPGRADE ,
1064+ ),
1065+ )
1066+
1067+
10111068async def test_workflows_can_use_versioning_override (
10121069 client : Client , env : WorkflowEnvironment
10131070):
0 commit comments