Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IWF-124: Ignore empty output for collector #524

Merged
merged 4 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion integ/internalchannel_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ func doTestInterStateWorkflow(t *testing.T, backendType service.BackendType, con
}, history, "interstate test fail, %v", history)

assertions.Equal(iwfidl.COMPLETED, resp2.GetWorkflowStatus())
assertions.Equal(1, len(resp2.GetResults()))
// State completions with empty output are ignored
assertions.Equal(0, len(resp2.GetResults()))
assertions.Equal(map[string]interface{}{
interstate.State21 + "received": interstate.TestVal1,
interstate.State31 + "received": interstate.TestVal2,
Expand Down
4 changes: 2 additions & 2 deletions integ/locking_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,6 @@ func doTestLockingWorkflow(t *testing.T, backendType service.BackendType, config

s2StartsDecides := locking.InParallelS2 + rpcIncrease // locking.InParallelS2 original state executions, and a new trigger from rpc
finalCounterValue := int64(locking.InParallelS2 + 2*rpcIncrease)
stateCompletionCount := locking.InParallelS2 + rpcIncrease + 1
history, _ := wfHandler.GetTestResult()
assertions.Equalf(map[string]int64{
"S1_start": 1,
Expand All @@ -210,7 +209,8 @@ func doTestLockingWorkflow(t *testing.T, backendType service.BackendType, config
}, history, "locking.test fail, %v", history)

assertions.Equal(iwfidl.COMPLETED, resp2.GetWorkflowStatus())
assertions.Equal(stateCompletionCount, len(resp2.GetResults()))
// State completions with empty output are ignored
assertions.Equal(0, len(resp2.GetResults()))

reqSearch := apiClient.DefaultApi.ApiV1WorkflowSearchattributesGetPost(context.Background())
searchResult2, httpResp, err := reqSearch.WorkflowGetSearchAttributesRequest(iwfidl.WorkflowGetSearchAttributesRequest{
Expand Down
8 changes: 2 additions & 6 deletions integ/wf_state_execute_api_fail_and_proceed_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,7 @@ func doTestStateExecuteApiFailAndProceed(t *testing.T, backendType service.Backe
assertions.Equalf(&iwfidl.WorkflowGetResponse{
WorkflowRunId: startResp.GetWorkflowRunId(),
WorkflowStatus: iwfidl.COMPLETED,
Results: []iwfidl.StateCompletionOutput{
{
CompletedStateId: wf_execute_api_fail_and_proceed.StateRecover,
CompletedStateExecutionId: wf_execute_api_fail_and_proceed.StateRecover + "-1",
},
},
// State completions with empty output are ignored
Results: []iwfidl.StateCompletionOutput(nil),
}, resp, "response not expected")
}
8 changes: 2 additions & 6 deletions integ/wf_state_wait_until_api_fail_and_proceed_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,7 @@ func doTestStateApiFailAndProceed(t *testing.T, backendType service.BackendType,
assertions.Equalf(&iwfidl.WorkflowGetResponse{
WorkflowRunId: startResp.GetWorkflowRunId(),
WorkflowStatus: iwfidl.COMPLETED,
Results: []iwfidl.StateCompletionOutput{
{
CompletedStateId: wf_state_api_fail_and_proceed.State1,
CompletedStateExecutionId: wf_state_api_fail_and_proceed.State1 + "-1",
},
},
// State completions with empty output are ignored
Results: []iwfidl.StateCompletionOutput(nil),
}, resp, "response not expected")
}
4 changes: 3 additions & 1 deletion service/interpreter/outputCollector.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ func NewOutputCollector(initOutputs []iwfidl.StateCompletionOutput) *OutputColle
}

func (o *OutputCollector) Add(output iwfidl.StateCompletionOutput) {
o.outputs = append(o.outputs, output)
if output.CompletedStateOutput != nil {
o.outputs = append(o.outputs, output)
}
}

func (o *OutputCollector) GetAll() []iwfidl.StateCompletionOutput {
Expand Down
Loading