Skip to content

Commit 243e756

Browse files
committed
add tests
1 parent 5df8749 commit 243e756

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

internal/internal_event_handlers_test.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

823840
func TestMutableSideEffect(t *testing.T) {

0 commit comments

Comments
 (0)