@@ -114,7 +114,9 @@ func TestInvokeFC(t *testing.T) {
114114
115115 // check result
116116 output := resultMap .Result [f .Signature .GetOutputs ()[0 ].Name ]
117- u .AssertEquals (t , length , output .(int ))
117+ if length != int (output .(float64 )) {
118+ t .FailNow ()
119+ }
118120
119121 // cleaning up function composition and function
120122 err3 := wflow .Delete ()
@@ -564,3 +566,52 @@ func TestInvokeWorkflowPassDoNothing(t *testing.T) {
564566 u .AssertNilMsg (t , err , "Result not found" )
565567 u .AssertEquals (t , 3 , result )
566568}
569+
570+ // TestResumeWorkflow offloads the execution of an invocation request to the same node
571+ func TestResumeWorkflow (t * testing.T ) {
572+
573+ if testing .Short () {
574+ t .Skip ("Skipping integration test" )
575+ }
576+
577+ workflowName := "test"
578+ // CREATE - we create a test function composition
579+ length := 5
580+ f , fArr , err := initializeSameFunctionSlice (length , "js" )
581+ u .AssertNil (t , err )
582+ wflow , err := CreateSequenceWorkflow (fArr ... )
583+ wflow .Name = workflowName
584+ u .AssertNil (t , err )
585+ err1 := wflow .Save ()
586+ u .AssertNil (t , err1 )
587+
588+ // INVOKE - we call the function composition
589+ params := make (map [string ]interface {})
590+ params [f .Signature .GetInputs ()[0 ].Name ] = 0
591+
592+ request := workflow .NewRequest (shortuuid .New (), wflow , params )
593+
594+ progress := workflow .InitProgress (workflow .ReqId (request .Id ), wflow )
595+ pd := workflow .NewPartialData (workflow .ReqId (request .Id ), wflow .Start .Next , "" , request .Params )
596+
597+ err = workflow .SaveProgress (progress , true )
598+ u .AssertNil (t , err )
599+ err = workflow .SavePartialData (pd , true )
600+ u .AssertNil (t , err )
601+
602+ resumedRequest := workflow .NewRequest (request .Id , wflow , params )
603+ resumedRequest .Resuming = true
604+
605+ resultMap , err2 := wflow .Invoke (resumedRequest )
606+ u .AssertNil (t , err2 )
607+
608+ // check result
609+ output := resultMap .Result [f .Signature .GetOutputs ()[0 ].Name ]
610+ if length != int (output .(float64 )) {
611+ t .FailNow ()
612+ }
613+
614+ // cleaning up function composition and function
615+ err3 := wflow .Delete ()
616+ u .AssertNil (t , err3 )
617+ }
0 commit comments