@@ -872,6 +872,88 @@ export function runIntegrationTests(codec?: PayloadCodec): void {
872
872
t . is ( timeSlept , 1 ) ;
873
873
} ) ;
874
874
875
+ test ( 'continue-as-new-to-same-workflow keeps memo and search attributes' , async ( t ) => {
876
+ const { client } = t . context ;
877
+ const workflow = await client . start ( workflows . continueAsNewSameWorkflow , {
878
+ taskQueue : 'test' ,
879
+ workflowId : uuid4 ( ) ,
880
+ memo : {
881
+ note : 'foo' ,
882
+ } ,
883
+ searchAttributes : {
884
+ CustomKeywordField : [ 'test-value' ] ,
885
+ CustomIntField : [ 1 , 2 ] ,
886
+ } ,
887
+ followRuns : true ,
888
+ } ) ;
889
+ await workflow . signal ( workflows . continueAsNewSignal ) ;
890
+ await workflow . result ( ) ;
891
+
892
+ const execution = await workflow . describe ( ) ;
893
+ t . not ( execution . runId , workflow . firstExecutionRunId ) ;
894
+ t . deepEqual ( execution . memo , { note : 'foo' } ) ;
895
+ t . deepEqual ( execution . searchAttributes ! . CustomKeywordField , [ 'test-value' ] ) ;
896
+ t . deepEqual ( execution . searchAttributes ! . CustomIntField , [ 1 , 2 ] ) ;
897
+ } ) ;
898
+
899
+ test ( 'continue-as-new-to-different-workflow keeps memo and search attributes by default' , async ( t ) => {
900
+ const { client } = t . context ;
901
+ const workflow = await client . start ( workflows . continueAsNewToDifferentWorkflow , {
902
+ taskQueue : 'test' ,
903
+ workflowId : uuid4 ( ) ,
904
+ followRuns : true ,
905
+ memo : {
906
+ note : 'foo' ,
907
+ } ,
908
+ searchAttributes : {
909
+ CustomKeywordField : [ 'test-value' ] ,
910
+ CustomIntField : [ 1 , 2 ] ,
911
+ } ,
912
+ } ) ;
913
+ await workflow . result ( ) ;
914
+ const info = await workflow . describe ( ) ;
915
+ t . is ( info . type , 'sleeper' ) ;
916
+ t . not ( info . runId , workflow . firstExecutionRunId ) ;
917
+ t . deepEqual ( info . memo , { note : 'foo' } ) ;
918
+ t . deepEqual ( info . searchAttributes ! . CustomKeywordField , [ 'test-value' ] ) ;
919
+ t . deepEqual ( info . searchAttributes ! . CustomIntField , [ 1 , 2 ] ) ;
920
+ } ) ;
921
+
922
+ test ( 'continue-as-new-to-different-workflow can set memo and search attributes' , async ( t ) => {
923
+ const { client } = t . context ;
924
+ const workflow = await client . start ( workflows . continueAsNewToDifferentWorkflow , {
925
+ args : [
926
+ 1 ,
927
+ {
928
+ memo : {
929
+ note : 'bar' ,
930
+ } ,
931
+ searchAttributes : {
932
+ CustomKeywordField : [ 'test-value-2' ] ,
933
+ CustomIntField : [ 3 , 4 ] ,
934
+ } ,
935
+ } ,
936
+ ] ,
937
+ taskQueue : 'test' ,
938
+ workflowId : uuid4 ( ) ,
939
+ followRuns : true ,
940
+ memo : {
941
+ note : 'foo' ,
942
+ } ,
943
+ searchAttributes : {
944
+ CustomKeywordField : [ 'test-value' ] ,
945
+ CustomIntField : [ 1 , 2 ] ,
946
+ } ,
947
+ } ) ;
948
+ await workflow . result ( ) ;
949
+ const info = await workflow . describe ( ) ;
950
+ t . is ( info . type , 'sleeper' ) ;
951
+ t . not ( info . runId , workflow . firstExecutionRunId ) ;
952
+ t . deepEqual ( info . memo , { note : 'bar' } ) ;
953
+ t . deepEqual ( info . searchAttributes ! . CustomKeywordField , [ 'test-value-2' ] ) ;
954
+ t . deepEqual ( info . searchAttributes ! . CustomIntField , [ 3 , 4 ] ) ;
955
+ } ) ;
956
+
875
957
test ( 'signalWithStart works as intended and returns correct runId' , async ( t ) => {
876
958
const { client } = t . context ;
877
959
const ogWF = await client . signalWithStart ( workflows . interruptableWorkflow , {
0 commit comments