From c17ff977959845aea4948e22f1ccb8f5484d4038 Mon Sep 17 00:00:00 2001 From: Ba'tiar Afas Rahmamulia Date: Fri, 10 Nov 2023 09:30:57 +0700 Subject: [PATCH] [UNIT TEST] Update mockgen and create client mock (#72) --- README.md | 21 +- go.mod | 6 +- go.sum | 35 +- integ/basic_test.go | 1 + integ/main_test.go | 10 +- integ/persistence_workflow_state2.go | 2 +- integ/signal_test.go | 13 +- iwf/client.go | 3 + iwf/communication.go | 2 + iwf/persistence.go | 5 +- iwf/worker_service_impl.go | 7 + iwf/workflow_context.go | 2 + iwftest/README.md | 13 +- iwftest/client.go | 655 +++++++++++++++++++++++++++ iwftest/communication.go | 18 +- iwftest/example/example_test.go | 5 +- iwftest/persistence.go | 58 +-- iwftest/workflow_context.go | 12 +- 18 files changed, 770 insertions(+), 98 deletions(-) create mode 100644 iwftest/client.go diff --git a/README.md b/README.md index e727159..2ba81b0 100644 --- a/README.md +++ b/README.md @@ -1,21 +1,22 @@ # iWF Golang SDK + [![Go Reference](https://pkg.go.dev/badge/github.com/indeedeng/iwf-golang-sdk.svg)](https://pkg.go.dev/github.com/indeedeng/iwf-golang-sdk) [![Go Report Card](https://goreportcard.com/badge/github.com/indeedeng/iwf-golang-sdk)](https://goreportcard.com/report/github.com/indeedeng/iwf-golang-sdk) [![Coverage Status](https://codecov.io/github/indeedeng/iwf-golang-sdk/coverage.svg?branch=main)](https://app.codecov.io/gh/indeedeng/iwf-golang-sdk/branch/main) [![Build status](https://github.com/indeedeng/iwf-golang-sdk/actions/workflows/ci-integ-test.yml/badge.svg?branch=main)](https://github.com/indeedeng/iwf-golang-sdk/actions/workflows/ci-integ-test.yml) - - Golang SDK for [iWF workflow engine](https://github.com/indeedeng/iwf) See [samples](https://github.com/indeedeng/iwf-golang-samples) for how to use this SDK. -# Contribution + +## Contribution + See [contribution guide](CONTRIBUTION.md) -# Development Plan +## Development Plan -## 1.0 +### 1.0 - [x] Start workflow API - [x] Executing `start`/`decide` APIs and completing workflow @@ -37,20 +38,22 @@ See [contribution guide](CONTRIBUTION.md) - [x] Reset workflow by stateId/StateExecutionId - [x] More workflow start options: initial search attributes -## 1.1 +### 1.1 - [x] Skip timer API for testing/operation - [x] Decider trigger type: any command combination -## 1.2 +### 1.2 + - [x] API improvements to reduce boilerplate code -## 1.3 +### 1.3 + - [x] Support failing workflow with results - [x] Improve workflow uncompleted error return(canceled, failed, timeout, terminated) ### 1.4 -- [x] Renaming some concepts/APIs with breaking changes(see releaste notes) +- [x] Renaming some concepts/APIs with breaking changes(see release notes) - [x] Support workflow RPC - [x] PARTIAL_WITH_EXCLUSIVE_LOCK persistence loading type diff --git a/go.mod b/go.mod index 1d1f53e..4cb47ef 100644 --- a/go.mod +++ b/go.mod @@ -4,9 +4,8 @@ go 1.18 require ( github.com/gin-gonic/gin v1.8.2 - github.com/golang/mock v1.6.0 github.com/stretchr/testify v1.8.1 - golang.org/x/oauth2 v0.3.0 + go.uber.org/mock v0.3.0 ) require ( @@ -16,7 +15,7 @@ require ( github.com/go-playground/universal-translator v0.18.0 // indirect github.com/go-playground/validator/v10 v10.11.1 // indirect github.com/goccy/go-json v0.9.11 // indirect - github.com/golang/protobuf v1.5.2 // indirect + github.com/google/go-cmp v0.5.8 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/leodido/go-urn v1.2.1 // indirect github.com/mattn/go-isatty v0.0.16 // indirect @@ -29,7 +28,6 @@ require ( golang.org/x/net v0.4.0 // indirect golang.org/x/sys v0.3.0 // indirect golang.org/x/text v0.5.0 // indirect - google.golang.org/appengine v1.6.7 // indirect google.golang.org/protobuf v1.28.1 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/go.sum b/go.sum index 8eb67ba..17d9556 100644 --- a/go.sum +++ b/go.sum @@ -16,14 +16,10 @@ github.com/go-playground/validator/v10 v10.11.1 h1:prmOlTVv+YjZjmRmNSF3VmspqJIxJ github.com/go-playground/validator/v10 v10.11.1/go.mod h1:i+3WkQ1FvaUjjxh1kSvIA4dMGDBiPU55YFDl0WbKdWU= github.com/goccy/go-json v0.9.11 h1:/pAaQDLHEoCq/5FFmSKBswWmK6H0e8g4159Kc/X/nqk= github.com/goccy/go-json v0.9.11/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= -github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= -github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= -github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= +github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= @@ -64,53 +60,28 @@ github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o github.com/ugorji/go v1.2.7/go.mod h1:nF9osbDWLy6bDVv/Rtoh6QgnvNDpmCalQV5urGCCS6M= github.com/ugorji/go/codec v1.2.7 h1:YPXUKf7fYbp/y8xloBqZOw2qaVggbfwMlI8WM3wZUJ0= github.com/ugorji/go/codec v1.2.7/go.mod h1:WGN1fab3R1fzQlVQTkfxVtIBhWDRqOviHU95kRgeqEY= -github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +go.uber.org/mock v0.3.0 h1:3mUxI1No2/60yUYax92Pt8eNOEecx2D3lcXZh2NEZJo= +go.uber.org/mock v0.3.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3 h1:0es+/5331RGQPcXlMfP+WrnIIS6dNnNRe0WB02W0F4M= golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.4.0 h1:Q5QPcMlvfxFTAPV0+07Xz/MpK9NTXu2VDUuy0FeMfaU= golang.org/x/net v0.4.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= -golang.org/x/oauth2 v0.3.0 h1:6l90koy8/LaBLmLu8jpHeHexzMwEita0zFfYlggy2F8= -golang.org/x/oauth2 v0.3.0/go.mod h1:rQrIauxkUhJ6CuwEXwymO2/eh4xz2ZWF1nBkcxS+tGk= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.3.0 h1:w8ZOecv6NaNa/zC8944JTU3vz4u6Lagfk4RPQxv92NQ= golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.5.0 h1:OLmvp0KP+FVG99Ct/qFiL/Fhk4zp4QQnZ7b2U+5piUM= golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= -google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/integ/basic_test.go b/integ/basic_test.go index 7428e92..a866f2b 100644 --- a/integ/basic_test.go +++ b/integ/basic_test.go @@ -51,4 +51,5 @@ func TestProceedOnStateStartFailWorkflow(t *testing.T) { var output string err = client.GetSimpleWorkflowResult(context.Background(), wfId, "", &output) assert.Equal(t, "input_state1_start_state1_decide_state2_start_state2_decide", output) + assert.Nil(t, err) } diff --git a/integ/main_test.go b/integ/main_test.go index c34baa9..927f6ac 100644 --- a/integ/main_test.go +++ b/integ/main_test.go @@ -2,13 +2,14 @@ package integ import ( "fmt" - "github.com/gin-gonic/gin" - "github.com/indeedeng/iwf-golang-sdk/gen/iwfidl" - "github.com/indeedeng/iwf-golang-sdk/iwf" "log" "net/http" "os" "testing" + + "github.com/gin-gonic/gin" + "github.com/indeedeng/iwf-golang-sdk/gen/iwfidl" + "github.com/indeedeng/iwf-golang-sdk/iwf" ) func TestMain(m *testing.M) { @@ -33,7 +34,6 @@ func apiV1WorkflowStateStart(c *gin.Context) { return } c.JSON(http.StatusOK, resp) - return } func apiV1WorkflowStateDecide(c *gin.Context) { var req iwfidl.WorkflowStateExecuteRequest @@ -48,7 +48,6 @@ func apiV1WorkflowStateDecide(c *gin.Context) { return } c.JSON(http.StatusOK, resp) - return } func apiV1WorkflowWorkerRpc(c *gin.Context) { @@ -67,7 +66,6 @@ func apiV1WorkflowWorkerRpc(c *gin.Context) { return } c.JSON(http.StatusOK, resp) - return } func startWorkflowWorker() (closeFunc func()) { diff --git a/integ/persistence_workflow_state2.go b/integ/persistence_workflow_state2.go index 5e6579e..14f4655 100644 --- a/integ/persistence_workflow_state2.go +++ b/integ/persistence_workflow_state2.go @@ -21,7 +21,7 @@ func (b persistenceWorkflowState2) WaitUntil(ctx iwf.WorkflowContext, input iwf. dv := persistence.GetSearchAttributeDatetime(testSearchAttributeDatetime) bv := persistence.GetSearchAttributeBool(testSearchAttributeBool) persistence.SetSearchAttributeDouble(testSearchAttributeDouble, 1.0) - if dv.Unix() == do.Datetime.Unix() && bv == true { + if dv.Unix() == do.Datetime.Unix() && bv { persistence.SetSearchAttributeText(testSearchAttributeText, testText) return iwf.EmptyCommandRequest(), nil } diff --git a/integ/signal_test.go b/integ/signal_test.go index 4b7b161..a4e76f7 100644 --- a/integ/signal_test.go +++ b/integ/signal_test.go @@ -2,11 +2,12 @@ package integ import ( "context" - "github.com/indeedeng/iwf-golang-sdk/iwf" - "github.com/stretchr/testify/assert" "strconv" "testing" "time" + + "github.com/indeedeng/iwf-golang-sdk/iwf" + "github.com/stretchr/testify/assert" ) func TestSignalWorkflow(t *testing.T) { @@ -15,11 +16,15 @@ func TestSignalWorkflow(t *testing.T) { assert.Nil(t, err) assert.NotEmpty(t, runId) err = client.SignalWorkflow(context.Background(), &signalWorkflow{}, wfId, "", testChannelName2, 10) + assert.Nil(t, err) // wait for timer to be ready to be skipped time.Sleep(time.Second) err = client.SignalWorkflow(context.Background(), &signalWorkflow{}, wfId, "", testChannelName1, 100) + assert.Nil(t, err) + err = client.SkipTimerByCommandIndex(context.Background(), wfId, "", signalWorkflowState2{}, 1, 0) + assert.Nil(t, err) var output int err = client.GetSimpleWorkflowResult(context.Background(), wfId, "", &output) @@ -39,11 +44,15 @@ func TestSignalWorkflowWithUntypedClient(t *testing.T) { assert.Nil(t, err) assert.NotEmpty(t, runId) err = unregisteredClient.SignalWorkflow(context.Background(), wfId, "", testChannelName2, 10) + assert.Nil(t, err) // wait for timer to be ready to be skipped time.Sleep(time.Second) err = unregisteredClient.SignalWorkflow(context.Background(), wfId, "", testChannelName1, 100) + assert.Nil(t, err) + err = unregisteredClient.SkipTimerByCommandIndex(context.Background(), wfId, "", iwf.GetFinalWorkflowStateId(signalWorkflowState2{}), 1, 0) + assert.Nil(t, err) var output int err = unregisteredClient.GetSimpleWorkflowResult(context.Background(), wfId, "", &output) diff --git a/iwf/client.go b/iwf/client.go index 7a57562..0f4bf6a 100644 --- a/iwf/client.go +++ b/iwf/client.go @@ -1,7 +1,10 @@ package iwf +//go:generate mockgen -source=./client.go -package=iwftest -destination=../iwftest/client.go + import ( "context" + "github.com/indeedeng/iwf-golang-sdk/gen/iwfidl" ) diff --git a/iwf/communication.go b/iwf/communication.go index 63fc3a7..6b14591 100644 --- a/iwf/communication.go +++ b/iwf/communication.go @@ -1,5 +1,7 @@ package iwf +//go:generate mockgen -source=./communication.go -package=iwftest -destination=../iwftest/communication.go + import "github.com/indeedeng/iwf-golang-sdk/gen/iwfidl" type Communication interface { diff --git a/iwf/persistence.go b/iwf/persistence.go index bd8490e..43758d6 100644 --- a/iwf/persistence.go +++ b/iwf/persistence.go @@ -1,8 +1,11 @@ package iwf +//go:generate mockgen -source=./persistence.go -package=iwftest -destination=../iwftest/persistence.go + import ( - "github.com/indeedeng/iwf-golang-sdk/gen/iwfidl" "time" + + "github.com/indeedeng/iwf-golang-sdk/gen/iwfidl" ) // Persistence APIs are for read/write persistence of workflow diff --git a/iwf/worker_service_impl.go b/iwf/worker_service_impl.go index bc9640e..53f8806 100644 --- a/iwf/worker_service_impl.go +++ b/iwf/worker_service_impl.go @@ -2,6 +2,7 @@ package iwf import ( "context" + "github.com/indeedeng/iwf-golang-sdk/gen/iwfidl" ) @@ -33,6 +34,9 @@ func (w *workerServiceImpl) HandleWorkflowWorkerRPC(ctx context.Context, request } outputEncoded, err := w.options.ObjectEncoder.Encode(output) + if err != nil { + return nil, err + } resp = &iwfidl.WorkflowWorkerRpcResponse{ Output: outputEncoded, } @@ -178,6 +182,9 @@ func (w *workerServiceImpl) HandleWorkflowStateExecute(ctx context.Context, requ return nil, err } idlDecision, err := toIdlDecision(decision, wfType, w.registry, w.options.ObjectEncoder) + if err != nil { + return nil, err + } resp = &iwfidl.WorkflowStateExecuteResponse{ StateDecision: idlDecision, } diff --git a/iwf/workflow_context.go b/iwf/workflow_context.go index 3b6537c..6b8320f 100644 --- a/iwf/workflow_context.go +++ b/iwf/workflow_context.go @@ -1,5 +1,7 @@ package iwf +//go:generate mockgen -source=./workflow_context.go -package=iwftest -destination=../iwftest/workflow_context.go + import "context" type WorkflowContext interface { diff --git a/iwftest/README.md b/iwftest/README.md index 0ff7921..bbbbc83 100644 --- a/iwftest/README.md +++ b/iwftest/README.md @@ -1,13 +1,20 @@ -## Unit tests APIs for iWF +# Unit tests APIs for iWF + +The APIs are generated using [mockgen](https://github.com/uber-go/mock) by the below commands: -The APIs are generated by the below commands: ```shell mockgen -source=iwf/persistence.go -package=iwftest -destination=iwftest/persistence.go mockgen -source=iwf/communication.go -package=iwftest -destination=iwftest/communication.go mockgen -source=iwf/workflow_context.go -package=iwftest -destination=iwftest/workflow_context.go + mockgen -source=iwf/client.go -package=iwftest -destination=iwftest/client.go +``` + +or running this on sdk root folder + +```shell +go generate ./... ``` ## Usage See the [example](./example) for more details. - diff --git a/iwftest/client.go b/iwftest/client.go new file mode 100644 index 0000000..4b80259 --- /dev/null +++ b/iwftest/client.go @@ -0,0 +1,655 @@ +// Code generated by MockGen. DO NOT EDIT. +// Source: ./client.go +// +// Generated by this command: +// +// mockgen -source=./client.go -package=iwftest -destination=../iwftest/client.go +// +// Package iwftest is a generated GoMock package. +package iwftest + +import ( + context "context" + reflect "reflect" + + iwfidl "github.com/indeedeng/iwf-golang-sdk/gen/iwfidl" + iwf "github.com/indeedeng/iwf-golang-sdk/iwf" + gomock "go.uber.org/mock/gomock" +) + +// MockClient is a mock of Client interface. +type MockClient struct { + ctrl *gomock.Controller + recorder *MockClientMockRecorder +} + +// MockClientMockRecorder is the mock recorder for MockClient. +type MockClientMockRecorder struct { + mock *MockClient +} + +// NewMockClient creates a new mock instance. +func NewMockClient(ctrl *gomock.Controller) *MockClient { + mock := &MockClient{ctrl: ctrl} + mock.recorder = &MockClientMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockClient) EXPECT() *MockClientMockRecorder { + return m.recorder +} + +// DescribeWorkflow mocks base method. +func (m *MockClient) DescribeWorkflow(ctx context.Context, workflowId, workflowRunId string) (*iwf.WorkflowInfo, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DescribeWorkflow", ctx, workflowId, workflowRunId) + ret0, _ := ret[0].(*iwf.WorkflowInfo) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DescribeWorkflow indicates an expected call of DescribeWorkflow. +func (mr *MockClientMockRecorder) DescribeWorkflow(ctx, workflowId, workflowRunId any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DescribeWorkflow", reflect.TypeOf((*MockClient)(nil).DescribeWorkflow), ctx, workflowId, workflowRunId) +} + +// GetAllWorkflowDataAttributes mocks base method. +func (m *MockClient) GetAllWorkflowDataAttributes(ctx context.Context, workflowId, workflowRunId string) (map[string]iwf.Object, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetAllWorkflowDataAttributes", ctx, workflowId, workflowRunId) + ret0, _ := ret[0].(map[string]iwf.Object) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetAllWorkflowDataAttributes indicates an expected call of GetAllWorkflowDataAttributes. +func (mr *MockClientMockRecorder) GetAllWorkflowDataAttributes(ctx, workflowId, workflowRunId any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAllWorkflowDataAttributes", reflect.TypeOf((*MockClient)(nil).GetAllWorkflowDataAttributes), ctx, workflowId, workflowRunId) +} + +// GetAllWorkflowSearchAttributes mocks base method. +func (m *MockClient) GetAllWorkflowSearchAttributes(ctx context.Context, workflow iwf.ObjectWorkflow, workflowId, workflowRunId string) (map[string]any, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetAllWorkflowSearchAttributes", ctx, workflow, workflowId, workflowRunId) + ret0, _ := ret[0].(map[string]any) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetAllWorkflowSearchAttributes indicates an expected call of GetAllWorkflowSearchAttributes. +func (mr *MockClientMockRecorder) GetAllWorkflowSearchAttributes(ctx, workflow, workflowId, workflowRunId any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAllWorkflowSearchAttributes", reflect.TypeOf((*MockClient)(nil).GetAllWorkflowSearchAttributes), ctx, workflow, workflowId, workflowRunId) +} + +// GetComplexWorkflowResults mocks base method. +func (m *MockClient) GetComplexWorkflowResults(ctx context.Context, workflowId, workflowRunId string) ([]iwfidl.StateCompletionOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetComplexWorkflowResults", ctx, workflowId, workflowRunId) + ret0, _ := ret[0].([]iwfidl.StateCompletionOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetComplexWorkflowResults indicates an expected call of GetComplexWorkflowResults. +func (mr *MockClientMockRecorder) GetComplexWorkflowResults(ctx, workflowId, workflowRunId any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetComplexWorkflowResults", reflect.TypeOf((*MockClient)(nil).GetComplexWorkflowResults), ctx, workflowId, workflowRunId) +} + +// GetSimpleWorkflowResult mocks base method. +func (m *MockClient) GetSimpleWorkflowResult(ctx context.Context, workflowId, workflowRunId string, resultPtr any) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetSimpleWorkflowResult", ctx, workflowId, workflowRunId, resultPtr) + ret0, _ := ret[0].(error) + return ret0 +} + +// GetSimpleWorkflowResult indicates an expected call of GetSimpleWorkflowResult. +func (mr *MockClientMockRecorder) GetSimpleWorkflowResult(ctx, workflowId, workflowRunId, resultPtr any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSimpleWorkflowResult", reflect.TypeOf((*MockClient)(nil).GetSimpleWorkflowResult), ctx, workflowId, workflowRunId, resultPtr) +} + +// GetWorkflowDataAttributes mocks base method. +func (m *MockClient) GetWorkflowDataAttributes(ctx context.Context, workflow iwf.ObjectWorkflow, workflowId, workflowRunId string, keys []string) (map[string]iwf.Object, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetWorkflowDataAttributes", ctx, workflow, workflowId, workflowRunId, keys) + ret0, _ := ret[0].(map[string]iwf.Object) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetWorkflowDataAttributes indicates an expected call of GetWorkflowDataAttributes. +func (mr *MockClientMockRecorder) GetWorkflowDataAttributes(ctx, workflow, workflowId, workflowRunId, keys any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetWorkflowDataAttributes", reflect.TypeOf((*MockClient)(nil).GetWorkflowDataAttributes), ctx, workflow, workflowId, workflowRunId, keys) +} + +// GetWorkflowSearchAttributes mocks base method. +func (m *MockClient) GetWorkflowSearchAttributes(ctx context.Context, workflow iwf.ObjectWorkflow, workflowId, workflowRunId string, keys []string) (map[string]any, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetWorkflowSearchAttributes", ctx, workflow, workflowId, workflowRunId, keys) + ret0, _ := ret[0].(map[string]any) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetWorkflowSearchAttributes indicates an expected call of GetWorkflowSearchAttributes. +func (mr *MockClientMockRecorder) GetWorkflowSearchAttributes(ctx, workflow, workflowId, workflowRunId, keys any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetWorkflowSearchAttributes", reflect.TypeOf((*MockClient)(nil).GetWorkflowSearchAttributes), ctx, workflow, workflowId, workflowRunId, keys) +} + +// InvokeRPC mocks base method. +func (m *MockClient) InvokeRPC(ctx context.Context, workflowId, workflowRunId string, rpc iwf.RPC, input, outputPtr any) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "InvokeRPC", ctx, workflowId, workflowRunId, rpc, input, outputPtr) + ret0, _ := ret[0].(error) + return ret0 +} + +// InvokeRPC indicates an expected call of InvokeRPC. +func (mr *MockClientMockRecorder) InvokeRPC(ctx, workflowId, workflowRunId, rpc, input, outputPtr any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "InvokeRPC", reflect.TypeOf((*MockClient)(nil).InvokeRPC), ctx, workflowId, workflowRunId, rpc, input, outputPtr) +} + +// ResetWorkflow mocks base method. +func (m *MockClient) ResetWorkflow(ctx context.Context, workflowId, workflowRunId string, options *iwf.ResetWorkflowOptions) (string, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ResetWorkflow", ctx, workflowId, workflowRunId, options) + ret0, _ := ret[0].(string) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ResetWorkflow indicates an expected call of ResetWorkflow. +func (mr *MockClientMockRecorder) ResetWorkflow(ctx, workflowId, workflowRunId, options any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ResetWorkflow", reflect.TypeOf((*MockClient)(nil).ResetWorkflow), ctx, workflowId, workflowRunId, options) +} + +// SearchWorkflow mocks base method. +func (m *MockClient) SearchWorkflow(ctx context.Context, request iwfidl.WorkflowSearchRequest) (*iwfidl.WorkflowSearchResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SearchWorkflow", ctx, request) + ret0, _ := ret[0].(*iwfidl.WorkflowSearchResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// SearchWorkflow indicates an expected call of SearchWorkflow. +func (mr *MockClientMockRecorder) SearchWorkflow(ctx, request any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SearchWorkflow", reflect.TypeOf((*MockClient)(nil).SearchWorkflow), ctx, request) +} + +// SignalWorkflow mocks base method. +func (m *MockClient) SignalWorkflow(ctx context.Context, workflow iwf.ObjectWorkflow, workflowId, workflowRunId, signalChannelName string, signalValue any) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SignalWorkflow", ctx, workflow, workflowId, workflowRunId, signalChannelName, signalValue) + ret0, _ := ret[0].(error) + return ret0 +} + +// SignalWorkflow indicates an expected call of SignalWorkflow. +func (mr *MockClientMockRecorder) SignalWorkflow(ctx, workflow, workflowId, workflowRunId, signalChannelName, signalValue any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SignalWorkflow", reflect.TypeOf((*MockClient)(nil).SignalWorkflow), ctx, workflow, workflowId, workflowRunId, signalChannelName, signalValue) +} + +// SkipTimerByCommandId mocks base method. +func (m *MockClient) SkipTimerByCommandId(ctx context.Context, workflowId, workflowRunId string, workflowState iwf.WorkflowState, stateExecutionNumber int, timerCommandId string) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SkipTimerByCommandId", ctx, workflowId, workflowRunId, workflowState, stateExecutionNumber, timerCommandId) + ret0, _ := ret[0].(error) + return ret0 +} + +// SkipTimerByCommandId indicates an expected call of SkipTimerByCommandId. +func (mr *MockClientMockRecorder) SkipTimerByCommandId(ctx, workflowId, workflowRunId, workflowState, stateExecutionNumber, timerCommandId any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SkipTimerByCommandId", reflect.TypeOf((*MockClient)(nil).SkipTimerByCommandId), ctx, workflowId, workflowRunId, workflowState, stateExecutionNumber, timerCommandId) +} + +// SkipTimerByCommandIndex mocks base method. +func (m *MockClient) SkipTimerByCommandIndex(ctx context.Context, workflowId, workflowRunId string, workflowState iwf.WorkflowState, stateExecutionNumber, timerCommandIndex int) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SkipTimerByCommandIndex", ctx, workflowId, workflowRunId, workflowState, stateExecutionNumber, timerCommandIndex) + ret0, _ := ret[0].(error) + return ret0 +} + +// SkipTimerByCommandIndex indicates an expected call of SkipTimerByCommandIndex. +func (mr *MockClientMockRecorder) SkipTimerByCommandIndex(ctx, workflowId, workflowRunId, workflowState, stateExecutionNumber, timerCommandIndex any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SkipTimerByCommandIndex", reflect.TypeOf((*MockClient)(nil).SkipTimerByCommandIndex), ctx, workflowId, workflowRunId, workflowState, stateExecutionNumber, timerCommandIndex) +} + +// StartWorkflow mocks base method. +func (m *MockClient) StartWorkflow(ctx context.Context, workflow iwf.ObjectWorkflow, workflowId string, timeoutSecs int32, input any, options *iwf.WorkflowOptions) (string, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "StartWorkflow", ctx, workflow, workflowId, timeoutSecs, input, options) + ret0, _ := ret[0].(string) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// StartWorkflow indicates an expected call of StartWorkflow. +func (mr *MockClientMockRecorder) StartWorkflow(ctx, workflow, workflowId, timeoutSecs, input, options any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StartWorkflow", reflect.TypeOf((*MockClient)(nil).StartWorkflow), ctx, workflow, workflowId, timeoutSecs, input, options) +} + +// StopWorkflow mocks base method. +func (m *MockClient) StopWorkflow(ctx context.Context, workflowId, workflowRunId string, options *iwf.WorkflowStopOptions) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "StopWorkflow", ctx, workflowId, workflowRunId, options) + ret0, _ := ret[0].(error) + return ret0 +} + +// StopWorkflow indicates an expected call of StopWorkflow. +func (mr *MockClientMockRecorder) StopWorkflow(ctx, workflowId, workflowRunId, options any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StopWorkflow", reflect.TypeOf((*MockClient)(nil).StopWorkflow), ctx, workflowId, workflowRunId, options) +} + +// UpdateWorkflowConfig mocks base method. +func (m *MockClient) UpdateWorkflowConfig(ctx context.Context, workflowId, workflowRunId string, config iwfidl.WorkflowConfig) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UpdateWorkflowConfig", ctx, workflowId, workflowRunId, config) + ret0, _ := ret[0].(error) + return ret0 +} + +// UpdateWorkflowConfig indicates an expected call of UpdateWorkflowConfig. +func (mr *MockClientMockRecorder) UpdateWorkflowConfig(ctx, workflowId, workflowRunId, config any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateWorkflowConfig", reflect.TypeOf((*MockClient)(nil).UpdateWorkflowConfig), ctx, workflowId, workflowRunId, config) +} + +// MockClientCommon is a mock of ClientCommon interface. +type MockClientCommon struct { + ctrl *gomock.Controller + recorder *MockClientCommonMockRecorder +} + +// MockClientCommonMockRecorder is the mock recorder for MockClientCommon. +type MockClientCommonMockRecorder struct { + mock *MockClientCommon +} + +// NewMockClientCommon creates a new mock instance. +func NewMockClientCommon(ctrl *gomock.Controller) *MockClientCommon { + mock := &MockClientCommon{ctrl: ctrl} + mock.recorder = &MockClientCommonMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockClientCommon) EXPECT() *MockClientCommonMockRecorder { + return m.recorder +} + +// DescribeWorkflow mocks base method. +func (m *MockClientCommon) DescribeWorkflow(ctx context.Context, workflowId, workflowRunId string) (*iwf.WorkflowInfo, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DescribeWorkflow", ctx, workflowId, workflowRunId) + ret0, _ := ret[0].(*iwf.WorkflowInfo) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DescribeWorkflow indicates an expected call of DescribeWorkflow. +func (mr *MockClientCommonMockRecorder) DescribeWorkflow(ctx, workflowId, workflowRunId any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DescribeWorkflow", reflect.TypeOf((*MockClientCommon)(nil).DescribeWorkflow), ctx, workflowId, workflowRunId) +} + +// GetAllWorkflowDataAttributes mocks base method. +func (m *MockClientCommon) GetAllWorkflowDataAttributes(ctx context.Context, workflowId, workflowRunId string) (map[string]iwf.Object, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetAllWorkflowDataAttributes", ctx, workflowId, workflowRunId) + ret0, _ := ret[0].(map[string]iwf.Object) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetAllWorkflowDataAttributes indicates an expected call of GetAllWorkflowDataAttributes. +func (mr *MockClientCommonMockRecorder) GetAllWorkflowDataAttributes(ctx, workflowId, workflowRunId any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAllWorkflowDataAttributes", reflect.TypeOf((*MockClientCommon)(nil).GetAllWorkflowDataAttributes), ctx, workflowId, workflowRunId) +} + +// GetComplexWorkflowResults mocks base method. +func (m *MockClientCommon) GetComplexWorkflowResults(ctx context.Context, workflowId, workflowRunId string) ([]iwfidl.StateCompletionOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetComplexWorkflowResults", ctx, workflowId, workflowRunId) + ret0, _ := ret[0].([]iwfidl.StateCompletionOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetComplexWorkflowResults indicates an expected call of GetComplexWorkflowResults. +func (mr *MockClientCommonMockRecorder) GetComplexWorkflowResults(ctx, workflowId, workflowRunId any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetComplexWorkflowResults", reflect.TypeOf((*MockClientCommon)(nil).GetComplexWorkflowResults), ctx, workflowId, workflowRunId) +} + +// GetSimpleWorkflowResult mocks base method. +func (m *MockClientCommon) GetSimpleWorkflowResult(ctx context.Context, workflowId, workflowRunId string, resultPtr any) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetSimpleWorkflowResult", ctx, workflowId, workflowRunId, resultPtr) + ret0, _ := ret[0].(error) + return ret0 +} + +// GetSimpleWorkflowResult indicates an expected call of GetSimpleWorkflowResult. +func (mr *MockClientCommonMockRecorder) GetSimpleWorkflowResult(ctx, workflowId, workflowRunId, resultPtr any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSimpleWorkflowResult", reflect.TypeOf((*MockClientCommon)(nil).GetSimpleWorkflowResult), ctx, workflowId, workflowRunId, resultPtr) +} + +// ResetWorkflow mocks base method. +func (m *MockClientCommon) ResetWorkflow(ctx context.Context, workflowId, workflowRunId string, options *iwf.ResetWorkflowOptions) (string, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ResetWorkflow", ctx, workflowId, workflowRunId, options) + ret0, _ := ret[0].(string) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ResetWorkflow indicates an expected call of ResetWorkflow. +func (mr *MockClientCommonMockRecorder) ResetWorkflow(ctx, workflowId, workflowRunId, options any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ResetWorkflow", reflect.TypeOf((*MockClientCommon)(nil).ResetWorkflow), ctx, workflowId, workflowRunId, options) +} + +// SearchWorkflow mocks base method. +func (m *MockClientCommon) SearchWorkflow(ctx context.Context, request iwfidl.WorkflowSearchRequest) (*iwfidl.WorkflowSearchResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SearchWorkflow", ctx, request) + ret0, _ := ret[0].(*iwfidl.WorkflowSearchResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// SearchWorkflow indicates an expected call of SearchWorkflow. +func (mr *MockClientCommonMockRecorder) SearchWorkflow(ctx, request any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SearchWorkflow", reflect.TypeOf((*MockClientCommon)(nil).SearchWorkflow), ctx, request) +} + +// StopWorkflow mocks base method. +func (m *MockClientCommon) StopWorkflow(ctx context.Context, workflowId, workflowRunId string, options *iwf.WorkflowStopOptions) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "StopWorkflow", ctx, workflowId, workflowRunId, options) + ret0, _ := ret[0].(error) + return ret0 +} + +// StopWorkflow indicates an expected call of StopWorkflow. +func (mr *MockClientCommonMockRecorder) StopWorkflow(ctx, workflowId, workflowRunId, options any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StopWorkflow", reflect.TypeOf((*MockClientCommon)(nil).StopWorkflow), ctx, workflowId, workflowRunId, options) +} + +// UpdateWorkflowConfig mocks base method. +func (m *MockClientCommon) UpdateWorkflowConfig(ctx context.Context, workflowId, workflowRunId string, config iwfidl.WorkflowConfig) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UpdateWorkflowConfig", ctx, workflowId, workflowRunId, config) + ret0, _ := ret[0].(error) + return ret0 +} + +// UpdateWorkflowConfig indicates an expected call of UpdateWorkflowConfig. +func (mr *MockClientCommonMockRecorder) UpdateWorkflowConfig(ctx, workflowId, workflowRunId, config any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateWorkflowConfig", reflect.TypeOf((*MockClientCommon)(nil).UpdateWorkflowConfig), ctx, workflowId, workflowRunId, config) +} + +// MockUnregisteredClient is a mock of UnregisteredClient interface. +type MockUnregisteredClient struct { + ctrl *gomock.Controller + recorder *MockUnregisteredClientMockRecorder +} + +// MockUnregisteredClientMockRecorder is the mock recorder for MockUnregisteredClient. +type MockUnregisteredClientMockRecorder struct { + mock *MockUnregisteredClient +} + +// NewMockUnregisteredClient creates a new mock instance. +func NewMockUnregisteredClient(ctrl *gomock.Controller) *MockUnregisteredClient { + mock := &MockUnregisteredClient{ctrl: ctrl} + mock.recorder = &MockUnregisteredClientMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockUnregisteredClient) EXPECT() *MockUnregisteredClientMockRecorder { + return m.recorder +} + +// DescribeWorkflow mocks base method. +func (m *MockUnregisteredClient) DescribeWorkflow(ctx context.Context, workflowId, workflowRunId string) (*iwf.WorkflowInfo, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DescribeWorkflow", ctx, workflowId, workflowRunId) + ret0, _ := ret[0].(*iwf.WorkflowInfo) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DescribeWorkflow indicates an expected call of DescribeWorkflow. +func (mr *MockUnregisteredClientMockRecorder) DescribeWorkflow(ctx, workflowId, workflowRunId any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DescribeWorkflow", reflect.TypeOf((*MockUnregisteredClient)(nil).DescribeWorkflow), ctx, workflowId, workflowRunId) +} + +// GetAllWorkflowDataAttributes mocks base method. +func (m *MockUnregisteredClient) GetAllWorkflowDataAttributes(ctx context.Context, workflowId, workflowRunId string) (map[string]iwf.Object, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetAllWorkflowDataAttributes", ctx, workflowId, workflowRunId) + ret0, _ := ret[0].(map[string]iwf.Object) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetAllWorkflowDataAttributes indicates an expected call of GetAllWorkflowDataAttributes. +func (mr *MockUnregisteredClientMockRecorder) GetAllWorkflowDataAttributes(ctx, workflowId, workflowRunId any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAllWorkflowDataAttributes", reflect.TypeOf((*MockUnregisteredClient)(nil).GetAllWorkflowDataAttributes), ctx, workflowId, workflowRunId) +} + +// GetComplexWorkflowResults mocks base method. +func (m *MockUnregisteredClient) GetComplexWorkflowResults(ctx context.Context, workflowId, workflowRunId string) ([]iwfidl.StateCompletionOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetComplexWorkflowResults", ctx, workflowId, workflowRunId) + ret0, _ := ret[0].([]iwfidl.StateCompletionOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetComplexWorkflowResults indicates an expected call of GetComplexWorkflowResults. +func (mr *MockUnregisteredClientMockRecorder) GetComplexWorkflowResults(ctx, workflowId, workflowRunId any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetComplexWorkflowResults", reflect.TypeOf((*MockUnregisteredClient)(nil).GetComplexWorkflowResults), ctx, workflowId, workflowRunId) +} + +// GetSimpleWorkflowResult mocks base method. +func (m *MockUnregisteredClient) GetSimpleWorkflowResult(ctx context.Context, workflowId, workflowRunId string, resultPtr any) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetSimpleWorkflowResult", ctx, workflowId, workflowRunId, resultPtr) + ret0, _ := ret[0].(error) + return ret0 +} + +// GetSimpleWorkflowResult indicates an expected call of GetSimpleWorkflowResult. +func (mr *MockUnregisteredClientMockRecorder) GetSimpleWorkflowResult(ctx, workflowId, workflowRunId, resultPtr any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSimpleWorkflowResult", reflect.TypeOf((*MockUnregisteredClient)(nil).GetSimpleWorkflowResult), ctx, workflowId, workflowRunId, resultPtr) +} + +// GetWorkflowDataAttributes mocks base method. +func (m *MockUnregisteredClient) GetWorkflowDataAttributes(ctx context.Context, workflowId, workflowRunId string, keys []string) (map[string]iwf.Object, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetWorkflowDataAttributes", ctx, workflowId, workflowRunId, keys) + ret0, _ := ret[0].(map[string]iwf.Object) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetWorkflowDataAttributes indicates an expected call of GetWorkflowDataAttributes. +func (mr *MockUnregisteredClientMockRecorder) GetWorkflowDataAttributes(ctx, workflowId, workflowRunId, keys any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetWorkflowDataAttributes", reflect.TypeOf((*MockUnregisteredClient)(nil).GetWorkflowDataAttributes), ctx, workflowId, workflowRunId, keys) +} + +// GetWorkflowSearchAttributes mocks base method. +func (m *MockUnregisteredClient) GetWorkflowSearchAttributes(ctx context.Context, workflowId, workflowRunId string, keys []iwfidl.SearchAttributeKeyAndType) (map[string]iwfidl.SearchAttribute, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetWorkflowSearchAttributes", ctx, workflowId, workflowRunId, keys) + ret0, _ := ret[0].(map[string]iwfidl.SearchAttribute) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetWorkflowSearchAttributes indicates an expected call of GetWorkflowSearchAttributes. +func (mr *MockUnregisteredClientMockRecorder) GetWorkflowSearchAttributes(ctx, workflowId, workflowRunId, keys any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetWorkflowSearchAttributes", reflect.TypeOf((*MockUnregisteredClient)(nil).GetWorkflowSearchAttributes), ctx, workflowId, workflowRunId, keys) +} + +// InvokeRPCByName mocks base method. +func (m *MockUnregisteredClient) InvokeRPCByName(ctx context.Context, workflowId, workflowRunId, rpcName string, input, outputPtr any, rpcOptions *iwf.RPCOptions) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "InvokeRPCByName", ctx, workflowId, workflowRunId, rpcName, input, outputPtr, rpcOptions) + ret0, _ := ret[0].(error) + return ret0 +} + +// InvokeRPCByName indicates an expected call of InvokeRPCByName. +func (mr *MockUnregisteredClientMockRecorder) InvokeRPCByName(ctx, workflowId, workflowRunId, rpcName, input, outputPtr, rpcOptions any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "InvokeRPCByName", reflect.TypeOf((*MockUnregisteredClient)(nil).InvokeRPCByName), ctx, workflowId, workflowRunId, rpcName, input, outputPtr, rpcOptions) +} + +// ResetWorkflow mocks base method. +func (m *MockUnregisteredClient) ResetWorkflow(ctx context.Context, workflowId, workflowRunId string, options *iwf.ResetWorkflowOptions) (string, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ResetWorkflow", ctx, workflowId, workflowRunId, options) + ret0, _ := ret[0].(string) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ResetWorkflow indicates an expected call of ResetWorkflow. +func (mr *MockUnregisteredClientMockRecorder) ResetWorkflow(ctx, workflowId, workflowRunId, options any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ResetWorkflow", reflect.TypeOf((*MockUnregisteredClient)(nil).ResetWorkflow), ctx, workflowId, workflowRunId, options) +} + +// SearchWorkflow mocks base method. +func (m *MockUnregisteredClient) SearchWorkflow(ctx context.Context, request iwfidl.WorkflowSearchRequest) (*iwfidl.WorkflowSearchResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SearchWorkflow", ctx, request) + ret0, _ := ret[0].(*iwfidl.WorkflowSearchResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// SearchWorkflow indicates an expected call of SearchWorkflow. +func (mr *MockUnregisteredClientMockRecorder) SearchWorkflow(ctx, request any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SearchWorkflow", reflect.TypeOf((*MockUnregisteredClient)(nil).SearchWorkflow), ctx, request) +} + +// SignalWorkflow mocks base method. +func (m *MockUnregisteredClient) SignalWorkflow(ctx context.Context, workflowId, workflowRunId, signalChannelName string, signalValue any) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SignalWorkflow", ctx, workflowId, workflowRunId, signalChannelName, signalValue) + ret0, _ := ret[0].(error) + return ret0 +} + +// SignalWorkflow indicates an expected call of SignalWorkflow. +func (mr *MockUnregisteredClientMockRecorder) SignalWorkflow(ctx, workflowId, workflowRunId, signalChannelName, signalValue any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SignalWorkflow", reflect.TypeOf((*MockUnregisteredClient)(nil).SignalWorkflow), ctx, workflowId, workflowRunId, signalChannelName, signalValue) +} + +// SkipTimerByCommandId mocks base method. +func (m *MockUnregisteredClient) SkipTimerByCommandId(ctx context.Context, workflowId, workflowRunId, workflowStateId string, stateExecutionNumber int, timerCommandId string) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SkipTimerByCommandId", ctx, workflowId, workflowRunId, workflowStateId, stateExecutionNumber, timerCommandId) + ret0, _ := ret[0].(error) + return ret0 +} + +// SkipTimerByCommandId indicates an expected call of SkipTimerByCommandId. +func (mr *MockUnregisteredClientMockRecorder) SkipTimerByCommandId(ctx, workflowId, workflowRunId, workflowStateId, stateExecutionNumber, timerCommandId any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SkipTimerByCommandId", reflect.TypeOf((*MockUnregisteredClient)(nil).SkipTimerByCommandId), ctx, workflowId, workflowRunId, workflowStateId, stateExecutionNumber, timerCommandId) +} + +// SkipTimerByCommandIndex mocks base method. +func (m *MockUnregisteredClient) SkipTimerByCommandIndex(ctx context.Context, workflowId, workflowRunId, workflowStateId string, stateExecutionNumber, timerCommandIndex int) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SkipTimerByCommandIndex", ctx, workflowId, workflowRunId, workflowStateId, stateExecutionNumber, timerCommandIndex) + ret0, _ := ret[0].(error) + return ret0 +} + +// SkipTimerByCommandIndex indicates an expected call of SkipTimerByCommandIndex. +func (mr *MockUnregisteredClientMockRecorder) SkipTimerByCommandIndex(ctx, workflowId, workflowRunId, workflowStateId, stateExecutionNumber, timerCommandIndex any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SkipTimerByCommandIndex", reflect.TypeOf((*MockUnregisteredClient)(nil).SkipTimerByCommandIndex), ctx, workflowId, workflowRunId, workflowStateId, stateExecutionNumber, timerCommandIndex) +} + +// StartWorkflow mocks base method. +func (m *MockUnregisteredClient) StartWorkflow(ctx context.Context, workflowType, startStateId, workflowId string, timeoutSecs int32, input any, options *iwf.UnregisteredWorkflowOptions) (string, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "StartWorkflow", ctx, workflowType, startStateId, workflowId, timeoutSecs, input, options) + ret0, _ := ret[0].(string) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// StartWorkflow indicates an expected call of StartWorkflow. +func (mr *MockUnregisteredClientMockRecorder) StartWorkflow(ctx, workflowType, startStateId, workflowId, timeoutSecs, input, options any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StartWorkflow", reflect.TypeOf((*MockUnregisteredClient)(nil).StartWorkflow), ctx, workflowType, startStateId, workflowId, timeoutSecs, input, options) +} + +// StopWorkflow mocks base method. +func (m *MockUnregisteredClient) StopWorkflow(ctx context.Context, workflowId, workflowRunId string, options *iwf.WorkflowStopOptions) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "StopWorkflow", ctx, workflowId, workflowRunId, options) + ret0, _ := ret[0].(error) + return ret0 +} + +// StopWorkflow indicates an expected call of StopWorkflow. +func (mr *MockUnregisteredClientMockRecorder) StopWorkflow(ctx, workflowId, workflowRunId, options any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StopWorkflow", reflect.TypeOf((*MockUnregisteredClient)(nil).StopWorkflow), ctx, workflowId, workflowRunId, options) +} + +// UpdateWorkflowConfig mocks base method. +func (m *MockUnregisteredClient) UpdateWorkflowConfig(ctx context.Context, workflowId, workflowRunId string, config iwfidl.WorkflowConfig) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UpdateWorkflowConfig", ctx, workflowId, workflowRunId, config) + ret0, _ := ret[0].(error) + return ret0 +} + +// UpdateWorkflowConfig indicates an expected call of UpdateWorkflowConfig. +func (mr *MockUnregisteredClientMockRecorder) UpdateWorkflowConfig(ctx, workflowId, workflowRunId, config any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateWorkflowConfig", reflect.TypeOf((*MockUnregisteredClient)(nil).UpdateWorkflowConfig), ctx, workflowId, workflowRunId, config) +} diff --git a/iwftest/communication.go b/iwftest/communication.go index 0588ef0..e9119ff 100644 --- a/iwftest/communication.go +++ b/iwftest/communication.go @@ -1,15 +1,19 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: iwf/communication.go - +// Source: ./communication.go +// +// Generated by this command: +// +// mockgen -source=./communication.go -package=iwftest -destination=../iwftest/communication.go +// // Package iwftest is a generated GoMock package. package iwftest import ( reflect "reflect" - gomock "github.com/golang/mock/gomock" iwfidl "github.com/indeedeng/iwf-golang-sdk/gen/iwfidl" iwf "github.com/indeedeng/iwf-golang-sdk/iwf" + gomock "go.uber.org/mock/gomock" ) // MockCommunication is a mock of Communication interface. @@ -64,13 +68,13 @@ func (mr *MockCommunicationMockRecorder) GetToTriggerStateMovements() *gomock.Ca } // PublishInternalChannel mocks base method. -func (m *MockCommunication) PublishInternalChannel(channelName string, value interface{}) { +func (m *MockCommunication) PublishInternalChannel(channelName string, value any) { m.ctrl.T.Helper() m.ctrl.Call(m, "PublishInternalChannel", channelName, value) } // PublishInternalChannel indicates an expected call of PublishInternalChannel. -func (mr *MockCommunicationMockRecorder) PublishInternalChannel(channelName, value interface{}) *gomock.Call { +func (mr *MockCommunicationMockRecorder) PublishInternalChannel(channelName, value any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PublishInternalChannel", reflect.TypeOf((*MockCommunication)(nil).PublishInternalChannel), channelName, value) } @@ -78,7 +82,7 @@ func (mr *MockCommunicationMockRecorder) PublishInternalChannel(channelName, val // TriggerStateMovements mocks base method. func (m *MockCommunication) TriggerStateMovements(movements ...iwf.StateMovement) { m.ctrl.T.Helper() - varargs := []interface{}{} + varargs := []any{} for _, a := range movements { varargs = append(varargs, a) } @@ -86,7 +90,7 @@ func (m *MockCommunication) TriggerStateMovements(movements ...iwf.StateMovement } // TriggerStateMovements indicates an expected call of TriggerStateMovements. -func (mr *MockCommunicationMockRecorder) TriggerStateMovements(movements ...interface{}) *gomock.Call { +func (mr *MockCommunicationMockRecorder) TriggerStateMovements(movements ...any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TriggerStateMovements", reflect.TypeOf((*MockCommunication)(nil).TriggerStateMovements), movements...) } diff --git a/iwftest/example/example_test.go b/iwftest/example/example_test.go index 0aca24b..b80ade0 100644 --- a/iwftest/example/example_test.go +++ b/iwftest/example/example_test.go @@ -1,11 +1,12 @@ package example import ( - "github.com/golang/mock/gomock" + "testing" + "github.com/indeedeng/iwf-golang-sdk/iwf" "github.com/indeedeng/iwf-golang-sdk/iwftest" "github.com/stretchr/testify/assert" - "testing" + "go.uber.org/mock/gomock" ) var mockWfCtx *iwftest.MockWorkflowContext diff --git a/iwftest/persistence.go b/iwftest/persistence.go index 5f27372..db54885 100644 --- a/iwftest/persistence.go +++ b/iwftest/persistence.go @@ -1,6 +1,10 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: iwf/persistence.go - +// Source: ./persistence.go +// +// Generated by this command: +// +// mockgen -source=./persistence.go -package=iwftest -destination=../iwftest/persistence.go +// // Package iwftest is a generated GoMock package. package iwftest @@ -8,8 +12,8 @@ import ( reflect "reflect" time "time" - gomock "github.com/golang/mock/gomock" iwfidl "github.com/indeedeng/iwf-golang-sdk/gen/iwfidl" + gomock "go.uber.org/mock/gomock" ) // MockPersistence is a mock of Persistence interface. @@ -36,13 +40,13 @@ func (m *MockPersistence) EXPECT() *MockPersistenceMockRecorder { } // GetDataAttribute mocks base method. -func (m *MockPersistence) GetDataAttribute(key string, valuePtr interface{}) { +func (m *MockPersistence) GetDataAttribute(key string, valuePtr any) { m.ctrl.T.Helper() m.ctrl.Call(m, "GetDataAttribute", key, valuePtr) } // GetDataAttribute indicates an expected call of GetDataAttribute. -func (mr *MockPersistenceMockRecorder) GetDataAttribute(key, valuePtr interface{}) *gomock.Call { +func (mr *MockPersistenceMockRecorder) GetDataAttribute(key, valuePtr any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetDataAttribute", reflect.TypeOf((*MockPersistence)(nil).GetDataAttribute), key, valuePtr) } @@ -56,7 +60,7 @@ func (m *MockPersistence) GetSearchAttributeBool(key string) bool { } // GetSearchAttributeBool indicates an expected call of GetSearchAttributeBool. -func (mr *MockPersistenceMockRecorder) GetSearchAttributeBool(key interface{}) *gomock.Call { +func (mr *MockPersistenceMockRecorder) GetSearchAttributeBool(key any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSearchAttributeBool", reflect.TypeOf((*MockPersistence)(nil).GetSearchAttributeBool), key) } @@ -70,7 +74,7 @@ func (m *MockPersistence) GetSearchAttributeDatetime(key string) time.Time { } // GetSearchAttributeDatetime indicates an expected call of GetSearchAttributeDatetime. -func (mr *MockPersistenceMockRecorder) GetSearchAttributeDatetime(key interface{}) *gomock.Call { +func (mr *MockPersistenceMockRecorder) GetSearchAttributeDatetime(key any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSearchAttributeDatetime", reflect.TypeOf((*MockPersistence)(nil).GetSearchAttributeDatetime), key) } @@ -84,7 +88,7 @@ func (m *MockPersistence) GetSearchAttributeDouble(key string) float64 { } // GetSearchAttributeDouble indicates an expected call of GetSearchAttributeDouble. -func (mr *MockPersistenceMockRecorder) GetSearchAttributeDouble(key interface{}) *gomock.Call { +func (mr *MockPersistenceMockRecorder) GetSearchAttributeDouble(key any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSearchAttributeDouble", reflect.TypeOf((*MockPersistence)(nil).GetSearchAttributeDouble), key) } @@ -98,7 +102,7 @@ func (m *MockPersistence) GetSearchAttributeInt(key string) int64 { } // GetSearchAttributeInt indicates an expected call of GetSearchAttributeInt. -func (mr *MockPersistenceMockRecorder) GetSearchAttributeInt(key interface{}) *gomock.Call { +func (mr *MockPersistenceMockRecorder) GetSearchAttributeInt(key any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSearchAttributeInt", reflect.TypeOf((*MockPersistence)(nil).GetSearchAttributeInt), key) } @@ -112,7 +116,7 @@ func (m *MockPersistence) GetSearchAttributeKeyword(key string) string { } // GetSearchAttributeKeyword indicates an expected call of GetSearchAttributeKeyword. -func (mr *MockPersistenceMockRecorder) GetSearchAttributeKeyword(key interface{}) *gomock.Call { +func (mr *MockPersistenceMockRecorder) GetSearchAttributeKeyword(key any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSearchAttributeKeyword", reflect.TypeOf((*MockPersistence)(nil).GetSearchAttributeKeyword), key) } @@ -126,7 +130,7 @@ func (m *MockPersistence) GetSearchAttributeKeywordArray(key string) []string { } // GetSearchAttributeKeywordArray indicates an expected call of GetSearchAttributeKeywordArray. -func (mr *MockPersistenceMockRecorder) GetSearchAttributeKeywordArray(key interface{}) *gomock.Call { +func (mr *MockPersistenceMockRecorder) GetSearchAttributeKeywordArray(key any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSearchAttributeKeywordArray", reflect.TypeOf((*MockPersistence)(nil).GetSearchAttributeKeywordArray), key) } @@ -140,19 +144,19 @@ func (m *MockPersistence) GetSearchAttributeText(key string) string { } // GetSearchAttributeText indicates an expected call of GetSearchAttributeText. -func (mr *MockPersistenceMockRecorder) GetSearchAttributeText(key interface{}) *gomock.Call { +func (mr *MockPersistenceMockRecorder) GetSearchAttributeText(key any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSearchAttributeText", reflect.TypeOf((*MockPersistence)(nil).GetSearchAttributeText), key) } // GetStateExecutionLocal mocks base method. -func (m *MockPersistence) GetStateExecutionLocal(key string, valuePtr interface{}) { +func (m *MockPersistence) GetStateExecutionLocal(key string, valuePtr any) { m.ctrl.T.Helper() m.ctrl.Call(m, "GetStateExecutionLocal", key, valuePtr) } // GetStateExecutionLocal indicates an expected call of GetStateExecutionLocal. -func (mr *MockPersistenceMockRecorder) GetStateExecutionLocal(key, valuePtr interface{}) *gomock.Call { +func (mr *MockPersistenceMockRecorder) GetStateExecutionLocal(key, valuePtr any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetStateExecutionLocal", reflect.TypeOf((*MockPersistence)(nil).GetStateExecutionLocal), key, valuePtr) } @@ -175,25 +179,25 @@ func (mr *MockPersistenceMockRecorder) GetToReturn() *gomock.Call { } // RecordEvent mocks base method. -func (m *MockPersistence) RecordEvent(key string, value interface{}) { +func (m *MockPersistence) RecordEvent(key string, value any) { m.ctrl.T.Helper() m.ctrl.Call(m, "RecordEvent", key, value) } // RecordEvent indicates an expected call of RecordEvent. -func (mr *MockPersistenceMockRecorder) RecordEvent(key, value interface{}) *gomock.Call { +func (mr *MockPersistenceMockRecorder) RecordEvent(key, value any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RecordEvent", reflect.TypeOf((*MockPersistence)(nil).RecordEvent), key, value) } // SetDataAttribute mocks base method. -func (m *MockPersistence) SetDataAttribute(key string, value interface{}) { +func (m *MockPersistence) SetDataAttribute(key string, value any) { m.ctrl.T.Helper() m.ctrl.Call(m, "SetDataAttribute", key, value) } // SetDataAttribute indicates an expected call of SetDataAttribute. -func (mr *MockPersistenceMockRecorder) SetDataAttribute(key, value interface{}) *gomock.Call { +func (mr *MockPersistenceMockRecorder) SetDataAttribute(key, value any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetDataAttribute", reflect.TypeOf((*MockPersistence)(nil).SetDataAttribute), key, value) } @@ -205,7 +209,7 @@ func (m *MockPersistence) SetSearchAttributeBool(key string, value bool) { } // SetSearchAttributeBool indicates an expected call of SetSearchAttributeBool. -func (mr *MockPersistenceMockRecorder) SetSearchAttributeBool(key, value interface{}) *gomock.Call { +func (mr *MockPersistenceMockRecorder) SetSearchAttributeBool(key, value any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetSearchAttributeBool", reflect.TypeOf((*MockPersistence)(nil).SetSearchAttributeBool), key, value) } @@ -217,7 +221,7 @@ func (m *MockPersistence) SetSearchAttributeDatetime(key string, value time.Time } // SetSearchAttributeDatetime indicates an expected call of SetSearchAttributeDatetime. -func (mr *MockPersistenceMockRecorder) SetSearchAttributeDatetime(key, value interface{}) *gomock.Call { +func (mr *MockPersistenceMockRecorder) SetSearchAttributeDatetime(key, value any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetSearchAttributeDatetime", reflect.TypeOf((*MockPersistence)(nil).SetSearchAttributeDatetime), key, value) } @@ -229,7 +233,7 @@ func (m *MockPersistence) SetSearchAttributeDouble(key string, value float64) { } // SetSearchAttributeDouble indicates an expected call of SetSearchAttributeDouble. -func (mr *MockPersistenceMockRecorder) SetSearchAttributeDouble(key, value interface{}) *gomock.Call { +func (mr *MockPersistenceMockRecorder) SetSearchAttributeDouble(key, value any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetSearchAttributeDouble", reflect.TypeOf((*MockPersistence)(nil).SetSearchAttributeDouble), key, value) } @@ -241,7 +245,7 @@ func (m *MockPersistence) SetSearchAttributeInt(key string, value int64) { } // SetSearchAttributeInt indicates an expected call of SetSearchAttributeInt. -func (mr *MockPersistenceMockRecorder) SetSearchAttributeInt(key, value interface{}) *gomock.Call { +func (mr *MockPersistenceMockRecorder) SetSearchAttributeInt(key, value any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetSearchAttributeInt", reflect.TypeOf((*MockPersistence)(nil).SetSearchAttributeInt), key, value) } @@ -253,7 +257,7 @@ func (m *MockPersistence) SetSearchAttributeKeyword(key, value string) { } // SetSearchAttributeKeyword indicates an expected call of SetSearchAttributeKeyword. -func (mr *MockPersistenceMockRecorder) SetSearchAttributeKeyword(key, value interface{}) *gomock.Call { +func (mr *MockPersistenceMockRecorder) SetSearchAttributeKeyword(key, value any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetSearchAttributeKeyword", reflect.TypeOf((*MockPersistence)(nil).SetSearchAttributeKeyword), key, value) } @@ -265,7 +269,7 @@ func (m *MockPersistence) SetSearchAttributeKeywordArray(key string, value []str } // SetSearchAttributeKeywordArray indicates an expected call of SetSearchAttributeKeywordArray. -func (mr *MockPersistenceMockRecorder) SetSearchAttributeKeywordArray(key, value interface{}) *gomock.Call { +func (mr *MockPersistenceMockRecorder) SetSearchAttributeKeywordArray(key, value any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetSearchAttributeKeywordArray", reflect.TypeOf((*MockPersistence)(nil).SetSearchAttributeKeywordArray), key, value) } @@ -277,19 +281,19 @@ func (m *MockPersistence) SetSearchAttributeText(key, value string) { } // SetSearchAttributeText indicates an expected call of SetSearchAttributeText. -func (mr *MockPersistenceMockRecorder) SetSearchAttributeText(key, value interface{}) *gomock.Call { +func (mr *MockPersistenceMockRecorder) SetSearchAttributeText(key, value any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetSearchAttributeText", reflect.TypeOf((*MockPersistence)(nil).SetSearchAttributeText), key, value) } // SetStateExecutionLocal mocks base method. -func (m *MockPersistence) SetStateExecutionLocal(key string, value interface{}) { +func (m *MockPersistence) SetStateExecutionLocal(key string, value any) { m.ctrl.T.Helper() m.ctrl.Call(m, "SetStateExecutionLocal", key, value) } // SetStateExecutionLocal indicates an expected call of SetStateExecutionLocal. -func (mr *MockPersistenceMockRecorder) SetStateExecutionLocal(key, value interface{}) *gomock.Call { +func (mr *MockPersistenceMockRecorder) SetStateExecutionLocal(key, value any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetStateExecutionLocal", reflect.TypeOf((*MockPersistence)(nil).SetStateExecutionLocal), key, value) } diff --git a/iwftest/workflow_context.go b/iwftest/workflow_context.go index d6a393c..7f67ef0 100644 --- a/iwftest/workflow_context.go +++ b/iwftest/workflow_context.go @@ -1,6 +1,10 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: iwf/workflow_context.go - +// Source: ./workflow_context.go +// +// Generated by this command: +// +// mockgen -source=./workflow_context.go -package=iwftest -destination=../iwftest/workflow_context.go +// // Package iwftest is a generated GoMock package. package iwftest @@ -8,7 +12,7 @@ import ( reflect "reflect" time "time" - gomock "github.com/golang/mock/gomock" + gomock "go.uber.org/mock/gomock" ) // MockWorkflowContext is a mock of WorkflowContext interface. @@ -170,7 +174,7 @@ func (m *MockWorkflowContext) Value(key any) any { } // Value indicates an expected call of Value. -func (mr *MockWorkflowContextMockRecorder) Value(key interface{}) *gomock.Call { +func (mr *MockWorkflowContextMockRecorder) Value(key any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Value", reflect.TypeOf((*MockWorkflowContext)(nil).Value), key) }