@@ -1454,3 +1454,87 @@ func (ts *WorkerDeploymentTestSuite) TestContinueAsNewWithVersionUpgrade() {
14541454 ts .NoError (wfHandle .Get (ctx , & result ))
14551455 ts .Equal ("v2.0" , result )
14561456}
1457+
1458+ func (ts * WorkerDeploymentTestSuite ) TestContinueAsNewWithRampingVersion () {
1459+ if os .Getenv ("DISABLE_SERVER_1_27_TESTS" ) != "" {
1460+ ts .T ().Skip ("temporal server 1.27+ required" )
1461+ }
1462+ ctx , cancel := context .WithTimeout (context .Background (), ctxTimeout )
1463+ defer cancel ()
1464+
1465+ deploymentName := "deploy-test-" + uuid .NewString ()
1466+ v1 := worker.WorkerDeploymentVersion {
1467+ DeploymentName : deploymentName ,
1468+ BuildID : "1.0" ,
1469+ }
1470+ v2 := worker.WorkerDeploymentVersion {
1471+ DeploymentName : deploymentName ,
1472+ BuildID : "2.0" ,
1473+ }
1474+
1475+ // Keep current at 1.0 and ramp 0% to 2.0. A continued run with
1476+ // UseRampingVersion should still start on 2.0.
1477+ worker1 := worker .New (ts .client , ts .taskQueueName , worker.Options {
1478+ DeploymentOptions : worker.DeploymentOptions {
1479+ UseVersioning : true ,
1480+ Version : v1 ,
1481+ },
1482+ })
1483+ worker1 .RegisterWorkflowWithOptions (ts .workflows .ContinueAsNewWithRampingVersionV1 , workflow.RegisterOptions {
1484+ Name : "ContinueAsNewWithRampingVersion" ,
1485+ VersioningBehavior : workflow .VersioningBehaviorPinned ,
1486+ })
1487+ ts .NoError (worker1 .Start ())
1488+ defer worker1 .Stop ()
1489+
1490+ worker2 := worker .New (ts .client , ts .taskQueueName , worker.Options {
1491+ DeploymentOptions : worker.DeploymentOptions {
1492+ UseVersioning : true ,
1493+ Version : v2 ,
1494+ },
1495+ })
1496+ worker2 .RegisterWorkflowWithOptions (ts .workflows .ContinueAsNewWithRampingVersionV2 , workflow.RegisterOptions {
1497+ Name : "ContinueAsNewWithRampingVersion" ,
1498+ VersioningBehavior : workflow .VersioningBehaviorPinned ,
1499+ })
1500+ ts .NoError (worker2 .Start ())
1501+ defer worker2 .Stop ()
1502+
1503+ dHandle := ts .client .WorkerDeploymentClient ().GetHandle (deploymentName )
1504+ ts .waitForWorkerDeployment (ctx , dHandle )
1505+ response1 , err := dHandle .Describe (ctx , client.WorkerDeploymentDescribeOptions {})
1506+ ts .NoError (err )
1507+
1508+ ts .waitForWorkerDeploymentVersion (ctx , dHandle , v1 )
1509+ response2 , err := dHandle .SetCurrentVersion (ctx , client.WorkerDeploymentSetCurrentVersionOptions {
1510+ BuildID : v1 .BuildID ,
1511+ ConflictToken : response1 .ConflictToken ,
1512+ })
1513+ ts .NoError (err )
1514+ ts .waitForWorkerDeploymentRoutingConfigPropagation (ctx , deploymentName , v1 .BuildID , "" )
1515+
1516+ wfHandle , err := ts .client .ExecuteWorkflow (
1517+ ctx ,
1518+ ts .startWorkflowOptions ("test-continueasnew-with-ramping-version" ),
1519+ "ContinueAsNewWithRampingVersion" ,
1520+ 0 ,
1521+ )
1522+ ts .NoError (err )
1523+ ts .waitForWorkflowRunningOnVersion (ctx , wfHandle , v1 .BuildID )
1524+
1525+ ts .waitForWorkerDeploymentVersion (ctx , dHandle , v2 )
1526+ // Set ramping percentage to 0%, ramping should still occur due to CaN.
1527+ _ , err = dHandle .SetRampingVersion (ctx , client.WorkerDeploymentSetRampingVersionOptions {
1528+ BuildID : v2 .BuildID ,
1529+ ConflictToken : response2 .ConflictToken ,
1530+ Percentage : float32 (0.0 ),
1531+ })
1532+ ts .NoError (err )
1533+ ts .waitForWorkerDeploymentRoutingConfigPropagation (ctx , deploymentName , v1 .BuildID , v2 .BuildID )
1534+
1535+ ts .NoError (ts .client .SignalWorkflow (ctx , wfHandle .GetID (), wfHandle .GetRunID (), "continue-as-new" , nil ))
1536+
1537+ var result string
1538+ ts .NoError (wfHandle .Get (ctx , & result ))
1539+ ts .Equal ("v2.0" , result )
1540+ }
0 commit comments