diff --git a/internal/workflow_testsuite.go b/internal/workflow_testsuite.go index ccda380a7..9985fdd58 100644 --- a/internal/workflow_testsuite.go +++ b/internal/workflow_testsuite.go @@ -89,9 +89,9 @@ type ( // Tests are welcome to implement their own version of this interface if they need to test more complex // update logic. This is a simple implementation to make testing basic Workflow Updates easier. TestUpdateCallback struct { - accept func() - reject func(error) - complete func(interface{}, error) + OnAccept func() + OnReject func(error) + OnComplete func(interface{}, error) } ) @@ -778,15 +778,15 @@ func (c *MockCallWrapper) NotBefore(calls ...*MockCallWrapper) *MockCallWrapper } func (uc *TestUpdateCallback) Accept() { - uc.accept() + uc.OnAccept() } func (uc *TestUpdateCallback) Reject(err error) { - uc.reject(err) + uc.OnReject(err) } func (uc *TestUpdateCallback) Complete(success interface{}, err error) { - uc.complete(success, err) + uc.OnComplete(success, err) } // ExecuteWorkflow executes a workflow, wait until workflow complete. It will fail the test if workflow is blocked and @@ -1103,11 +1103,11 @@ func (e *TestWorkflowEnvironment) UpdateWorkflowByID(workflowID, updateName, upd func (e *TestWorkflowEnvironment) UpdateWorkflowNoRejection(updateName string, updateID string, t mock.TestingT, args ...interface{}) { uc := &TestUpdateCallback{ - reject: func(err error) { + OnReject: func(err error) { require.Fail(t, "update should not be rejected") }, - accept: func() {}, - complete: func(interface{}, error) {}, + OnAccept: func() {}, + OnComplete: func(interface{}, error) {}, } e.UpdateWorkflow(updateName, updateID, uc, args) } diff --git a/internal/workflow_testsuite_test.go b/internal/workflow_testsuite_test.go index d9aef5bf1..9abe099c2 100644 --- a/internal/workflow_testsuite_test.go +++ b/internal/workflow_testsuite_test.go @@ -275,11 +275,11 @@ func TestWorkflowIDUpdateWorkflowByID(t *testing.T) { env := suite.NewTestWorkflowEnvironment() env.RegisterDelayedCallback(func() { err := env.UpdateWorkflowByID("my-workflow-id", "update", "id", &TestUpdateCallback{ - reject: func(err error) { + OnReject: func(err error) { require.Fail(t, "update should not be rejected") }, - accept: func() {}, - complete: func(interface{}, error) {}, + OnAccept: func() {}, + OnComplete: func(interface{}, error) {}, }, "input") require.NoError(t, err) }, time.Second) @@ -312,12 +312,12 @@ func TestChildWorkflowUpdate(t *testing.T) { }) env.RegisterDelayedCallback(func() { err := env.UpdateWorkflowByID("child-workflow", "child-handler", "1", &TestUpdateCallback{ - accept: func() { + OnAccept: func() { }, - reject: func(err error) { + OnReject: func(err error) { require.Fail(t, "update failed", err) }, - complete: func(result interface{}, err error) { + OnComplete: func(result interface{}, err error) { if err != nil { require.Fail(t, "update failed", err) } @@ -402,13 +402,13 @@ func TestWorkflowNotRegisteredRejected(t *testing.T) { var updateRejectionErr error env.RegisterDelayedCallback(func() { env.UpdateWorkflow("update", "id", &TestUpdateCallback{ - reject: func(err error) { + OnReject: func(err error) { updateRejectionErr = err }, - accept: func() { + OnAccept: func() { require.Fail(t, "update should not be accepted") }, - complete: func(interface{}, error) {}, + OnComplete: func(interface{}, error) {}, }) }, 0) @@ -433,13 +433,13 @@ func TestWorkflowUpdateOrderAcceptReject(t *testing.T) { var updateRejectionErr error env.RegisterDelayedCallback(func() { env.UpdateWorkflow("bad update", "2", &TestUpdateCallback{ - reject: func(err error) { + OnReject: func(err error) { updateRejectionErr = err }, - accept: func() { + OnAccept: func() { require.Fail(t, "update should not be accepted") }, - complete: func(interface{}, error) {}, + OnComplete: func(interface{}, error) {}, }) }, 0)