@@ -818,6 +818,23 @@ func TestGetVersion(t *testing.T) {
818818 assert .Equal (t , DefaultVersion , weh .changeVersions ["test" ])
819819 require .Nil (t , weh .workflowInfo .SearchAttributes , "ensure search attributes are not updated" )
820820 })
821+
822+ t .Run ("version doesn't exist, ExecuteWithVersion is used, version > maximum version" , func (t * testing.T ) {
823+ weh := testWorkflowExecutionEventHandler (t , newRegistry ())
824+ assert .PanicsWithValue (t , `Workflow code is too old to support version 10 for "test" changeID. The maximum supported version is 3` , func () {
825+ weh .GetVersion ("test" , DefaultVersion , 3 , ExecuteWithVersion (10 ))
826+ })
827+
828+ require .Nil (t , weh .workflowInfo .SearchAttributes , "ensure search attributes are not updated" )
829+ })
830+ t .Run ("version doesn't exist, ExecuteWithVersion is used, version < minimum version" , func (t * testing.T ) {
831+ weh := testWorkflowExecutionEventHandler (t , newRegistry ())
832+ assert .PanicsWithValue (t , `Workflow code removed support of version 0. for "test" changeID. The oldest supported version is 1` , func () {
833+ weh .GetVersion ("test" , 1 , 3 , ExecuteWithVersion (0 ))
834+ })
835+
836+ require .Nil (t , weh .workflowInfo .SearchAttributes , "ensure search attributes are not updated" )
837+ })
821838}
822839
823840func TestMutableSideEffect (t * testing.T ) {
0 commit comments