Skip to content

Commit 267036a

Browse files
committed
Update activities_test.go
1 parent 8c00f09 commit 267036a

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

service/worker/diagnostics/activities_test.go

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,8 +223,8 @@ func Test__identifyIssuesWithPaginatedHistory(t *testing.T) {
223223
History: &types.History{
224224
Events: []*types.HistoryEvent{
225225
{
226-
WorkflowExecutionContinuedAsNewEventAttributes: &types.WorkflowExecutionContinuedAsNewEventAttributes{
227-
FailureReason: common.StringPtr("cadenceInternal:Timeout START_TO_CLOSE"),
226+
WorkflowExecutionFailedEventAttributes: &types.WorkflowExecutionFailedEventAttributes{
227+
Reason: common.StringPtr("cadenceInternal:Timeout START_TO_CLOSE"),
228228
DecisionTaskCompletedEventID: 10,
229229
},
230230
},
@@ -259,18 +259,26 @@ func Test__identifyIssuesWithPaginatedHistory(t *testing.T) {
259259
}
260260
retryMetadataInBytes, err := json.Marshal(retryMetadata)
261261
require.NoError(t, err)
262+
failureMetadataInBytes, err := json.Marshal(failure.FailureIssuesMetadata{})
263+
require.NoError(t, err)
262264
expectedResult := []invariant.InvariantCheckResult{
263265
{
264266
IssueID: 0,
265267
InvariantType: retry.WorkflowRetryIssue.String(),
266268
Reason: "MaximumAttempts set to 1 will not retry since maximum attempts includes the first attempt.",
267269
Metadata: retryMetadataInBytes,
268270
},
271+
{
272+
IssueID: 0,
273+
InvariantType: failure.WorkflowFailed.String(),
274+
Reason: "The failure is caused by a timeout during the execution",
275+
Metadata: failureMetadataInBytes,
276+
},
269277
}
270278

271279
dwtest := &dw{
272280
clientBean: mockClientBean,
273-
invariants: []invariant.Invariant{retry.NewInvariant()},
281+
invariants: []invariant.Invariant{retry.NewInvariant(), failure.NewInvariant()},
274282
}
275283

276284
result, err := dwtest.identifyIssues(context.Background(), identifyIssuesParams{Execution: testExecution})

0 commit comments

Comments
 (0)