From a65bce653aea864ba75750ea7e2f8e405662984f Mon Sep 17 00:00:00 2001 From: lwolczynski Date: Tue, 28 Jan 2025 11:42:49 -0600 Subject: [PATCH] IWF-472: Testing --- ...wf_state_execute_api_fail_and_proceed_test.go | 16 ++++++++++++++-- integ/workflow/wf_state_api_timeout/routers.go | 4 ++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/integ/wf_state_execute_api_fail_and_proceed_test.go b/integ/wf_state_execute_api_fail_and_proceed_test.go index 4081b9a1..aea9dc05 100644 --- a/integ/wf_state_execute_api_fail_and_proceed_test.go +++ b/integ/wf_state_execute_api_fail_and_proceed_test.go @@ -4,6 +4,7 @@ import ( "context" "github.com/indeedeng/iwf/integ/workflow/wf_execute_api_fail_and_proceed" "github.com/indeedeng/iwf/service/common/ptr" + "net/http" "strconv" "testing" "time" @@ -13,6 +14,15 @@ import ( "github.com/stretchr/testify/assert" ) +func panicAtHttpError(err error, httpResp *http.Response) { + if err != nil { + panic(err) + } + if httpResp.StatusCode != http.StatusOK { + panic("Status not success" + httpResp.Status) + } +} + func TestStateExecuteApiFailAndProceedTemporal(t *testing.T) { if !*temporalIntegTest { t.Skip() @@ -84,14 +94,16 @@ func doTestStateExecuteApiFailAndProceed(t *testing.T, backendType service.Backe Encoding: ptr.Any(wf_execute_api_fail_and_proceed.InputDataEncoding), }, }).Execute() - failTestAtHttpError(err, httpResp, t) + // failTestAtHttpError(err, httpResp, t) + panicAtHttpError(err, httpResp) // wait for the workflow reqWait := apiClient.DefaultApi.ApiV1WorkflowGetWithWaitPost(context.Background()) resp, httpResp, err := reqWait.WorkflowGetRequest(iwfidl.WorkflowGetRequest{ WorkflowId: wfId, }).Execute() - failTestAtHttpError(err, httpResp, t) + // failTestAtHttpError(err, httpResp, t) + panicAtHttpError(err, httpResp) history, _ := wfHandler.GetTestResult() assertions := assert.New(t) diff --git a/integ/workflow/wf_state_api_timeout/routers.go b/integ/workflow/wf_state_api_timeout/routers.go index 4799124d..0c849c38 100644 --- a/integ/workflow/wf_state_api_timeout/routers.go +++ b/integ/workflow/wf_state_api_timeout/routers.go @@ -54,8 +54,8 @@ func (h *handler) ApiV1WorkflowStateStart(c *gin.Context, t *testing.T) { return } } - fmt.Println( - fmt.Sprintf("WorkflowType: %v", req.GetWorkflowType()), + fmt.Printf( + "WorkflowType: %v", req.GetWorkflowType(), ) helpers.FailTestWithErrorMessage("should not get here", t) }