From ec51f3a035fa061834bfdba589c930e1dea6fe89 Mon Sep 17 00:00:00 2001 From: Ketsia Date: Mon, 3 Jun 2024 00:50:05 +0200 Subject: [PATCH] use assert.ErrorContains() in tests --- .../execution/mutable_state_decision_task_manager_test.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/service/history/execution/mutable_state_decision_task_manager_test.go b/service/history/execution/mutable_state_decision_task_manager_test.go index f9bd24a3ea9..291c79f80fc 100644 --- a/service/history/execution/mutable_state_decision_task_manager_test.go +++ b/service/history/execution/mutable_state_decision_task_manager_test.go @@ -141,8 +141,7 @@ func TestReplicateDecisionTaskScheduledEvent(t *testing.T) { } }, assertions: func(t *testing.T, info *DecisionInfo, err error, observedLogs *observer.ObservedLogs) { - require.Error(t, err) - assert.Equal(t, "unable to change workflow state from 2 to 1, close status 0", err.Error()) + assert.ErrorContains(t, err, "unable to change workflow state from 2 to 1, close status 0") assert.Nil(t, info) }, }, @@ -160,8 +159,7 @@ func TestReplicateDecisionTaskScheduledEvent(t *testing.T) { mgr.msb.taskGenerator.(*MockMutableStateTaskGenerator).EXPECT().GenerateDecisionScheduleTasks(scheduleID).Return(errors.New("some error")) }, assertions: func(t *testing.T, info *DecisionInfo, err error, observedLogs *observer.ObservedLogs) { - require.Error(t, err) - assert.Equal(t, "some error", err.Error()) + assert.ErrorContains(t, err, "some error") assert.Nil(t, info) assert.Equal(t, 1, observedLogs.FilterMessage(fmt.Sprintf( "Decision Updated: {Schedule: %v, Started: %v, ID: %v, Timeout: %v, Attempt: %v, Timestamp: %v}",