diff --git a/go.mod b/go.mod index 81ea51a9..23a3f087 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,7 @@ require ( github.com/uber-go/tally/v4 v4.1.1 github.com/uber/cadence-idl v0.0.0-20220713235846-fda89e95df1e github.com/urfave/cli v1.22.5 - go.temporal.io/sdk v1.29.1 + go.temporal.io/sdk v1.30.0 go.temporal.io/sdk/contrib/tally v0.1.0 go.temporal.io/sdk/contrib/tools/workflowcheck v0.0.0-20220331154559-fd0d1eb548eb go.uber.org/cadence v0.17.1-0.20230105221902-f50f452a8eae // pin to pick GetUnhandledSignalNames API @@ -19,14 +19,12 @@ require ( gopkg.in/yaml.v3 v3.0.1 ) -require ( - github.com/pkg/errors v0.9.1 - go.temporal.io/api v1.39.0 -) +require go.temporal.io/api v1.40.0 require ( github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0 // indirect - github.com/nexus-rpc/sdk-go v0.0.10 // indirect + github.com/nexus-rpc/sdk-go v0.0.11 // indirect + github.com/pkg/errors v0.9.1 // indirect golang.org/x/crypto v0.26.0 // indirect golang.org/x/net v0.28.0 // indirect golang.org/x/sync v0.8.0 // indirect diff --git a/go.sum b/go.sum index 07c619e9..e3ff2478 100644 --- a/go.sum +++ b/go.sum @@ -269,8 +269,8 @@ github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9G github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/nexus-rpc/sdk-go v0.0.10 h1:7jEPUlsghxoD4OJ2H8YbFJ1t4wbxsUef7yZgBfyY3uA= -github.com/nexus-rpc/sdk-go v0.0.10/go.mod h1:TpfkM2Cw0Rlk9drGkoiSMpFqflKTiQLWUNyKJjF8mKQ= +github.com/nexus-rpc/sdk-go v0.0.11 h1:qH3Us3spfp50t5ca775V1va2eE6z1zMQDZY4mvbw0CI= +github.com/nexus-rpc/sdk-go v0.0.11/go.mod h1:TpfkM2Cw0Rlk9drGkoiSMpFqflKTiQLWUNyKJjF8mKQ= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/opentracing/opentracing-go v1.1.0 h1:pWlfV3Bxv7k65HYwkikxat0+s3pV4bsqf19k25Ur8rU= github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= @@ -399,11 +399,11 @@ go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.temporal.io/api v1.5.0/go.mod h1:BqKxEJJYdxb5dqf0ODfzfMxh8UEQ5L3zKS51FiIYYkA= -go.temporal.io/api v1.39.0 h1:pbhcfvNDB7mllb8lIBqPcg+m6LMG/IhTpdiFxe+0mYk= -go.temporal.io/api v1.39.0/go.mod h1:1WwYUMo6lao8yl0371xWUm13paHExN5ATYT/B7QtFis= +go.temporal.io/api v1.40.0 h1:rH3HvUUCFr0oecQTBW5tI6DdDQsX2Xb6OFVgt/bvLto= +go.temporal.io/api v1.40.0/go.mod h1:1WwYUMo6lao8yl0371xWUm13paHExN5ATYT/B7QtFis= go.temporal.io/sdk v1.12.0/go.mod h1:lSp3lH1lI0TyOsus0arnO3FYvjVXBZGi/G7DjnAnm6o= -go.temporal.io/sdk v1.29.1 h1:y+sUMbUhTU9rj50mwIZAPmcXCtgUdOWS9xHDYRYSgZ0= -go.temporal.io/sdk v1.29.1/go.mod h1:kp//DRvn3CqQVBCtjL51Oicp9wrZYB2s6row1UgzcKQ= +go.temporal.io/sdk v1.30.0 h1:7jzSFZYk+tQ2kIYEP+dvrM7AW9EsCEP52JHCjVGuwbI= +go.temporal.io/sdk v1.30.0/go.mod h1:Pv45F/fVDgWKx+jhix5t/dGgqROVaI+VjPLd3CHWqq0= go.temporal.io/sdk/contrib/tally v0.1.0 h1:edAcGKNIDYU7fd10e4C/43dHw/h1F9cACupcmIKwzPI= go.temporal.io/sdk/contrib/tally v0.1.0/go.mod h1:PckZI8gA0AxIBvrgT2FQlm8TaqptYmqRdy2NxOibsZQ= go.temporal.io/sdk/contrib/tools/workflowcheck v0.0.0-20220331154559-fd0d1eb548eb h1:cpSEAnCCkOtcwdY2NysRXdi4Ny19F5V5KplrAVl1/Mo= diff --git a/integ/locking_test.go b/integ/locking_test.go index 3f0ee9a6..72f490e2 100644 --- a/integ/locking_test.go +++ b/integ/locking_test.go @@ -83,7 +83,7 @@ func doTestLockingWorkflow(t *testing.T, backendType service.BackendType, config startReq := iwfidl.WorkflowStartRequest{ WorkflowId: wfId, IwfWorkflowType: locking.WorkflowType, - WorkflowTimeoutSeconds: 100, + WorkflowTimeoutSeconds: 300, IwfWorkerUrl: "http://localhost:" + testWorkflowServerPort, StartStateId: ptr.Any(locking.State1), WorkflowStartOptions: &iwfidl.WorkflowStartOptions{ @@ -245,4 +245,76 @@ func doTestLockingWorkflow(t *testing.T, backendType service.BackendType, config }, } assertions.ElementsMatch(expected1, queryResult1.GetObjects()) + + //reset here with reapply and compare counter + resetReq := apiClient.DefaultApi.ApiV1WorkflowResetPost(context.Background()) + _, httpResp, err = resetReq.WorkflowResetRequest(iwfidl.WorkflowResetRequest{ + WorkflowId: wfId, + ResetType: iwfidl.BEGINNING, + //SkipSignalReapply: ptr.Any(true), + }).Execute() + panicAtHttpError(err, httpResp) + + time.Sleep(time.Second * 20) + req2Reset := apiClient.DefaultApi.ApiV1WorkflowGetWithWaitPost(context.Background()) + resp2Reset, httpResp, err := req2Reset.WorkflowGetRequest(iwfidl.WorkflowGetRequest{ + WorkflowId: wfId, + }).Execute() + panicAtHttpError(err, httpResp) + + assertions.Equal(iwfidl.COMPLETED, resp2Reset.GetWorkflowStatus()) + + //TODO: There is a bug in the Temporal go SDK where only the first update method is actually executed. When that is fixed the following code can be uncommented to test resetting update methods. + //time.Sleep(time.Second * 10) + //reqRpcReset := apiClient.DefaultApi.ApiV1WorkflowRpcPost(context.Background()) + //_, httpResp, err = reqRpc.WorkflowRpcRequest(iwfidl.WorkflowRpcRequest{ + // WorkflowId: wfId, + // RpcName: locking.RPCName, + // Input: locking.UnblockValue, + //}).Execute() + //panicAtHttpError(err, httpResp) + + //time.Sleep(time.Second * 20) + //req2Reset := apiClient.DefaultApi.ApiV1WorkflowGetWithWaitPost(context.Background()) + //resp2Reset, httpResp, err := req2Reset.WorkflowGetRequest(iwfidl.WorkflowGetRequest{ + // WorkflowId: wfId, + //}).Execute() + //panicAtHttpError(err, httpResp) + + //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 + //resetHistory, _ := wfHandler.GetTestResult() + //assertions.Equalf(map[string]int64{ + // "S1_start": 1, + // "S1_decide": 1, + // "StateWaiting_start": 1, + // "StateWaiting_decide": 1, + // "S2_start": int64(s2StartsDecides), + // "S2_decide": int64(s2StartsDecides), + //}, resetHistory, "locking.test fail, %v", history) + // + //assertions.Equal(iwfidl.COMPLETED, resp2Reset.GetWorkflowStatus()) + //assertions.Equal(stateCompletionCount, len(resp2Reset.GetResults())) + // + //reqSearchReset := apiClient.DefaultApi.ApiV1WorkflowSearchattributesGetPost(context.Background()) + //searchResultReset, httpResp, err := reqSearchReset.WorkflowGetSearchAttributesRequest(iwfidl.WorkflowGetSearchAttributesRequest{ + // WorkflowId: wfId, + // Keys: []iwfidl.SearchAttributeKeyAndType{ + // { + // Key: iwfidl.PtrString(locking.TestSearchAttributeIntKey), + // ValueType: ptr.Any(iwfidl.INT), + // }, + // }, + //}).Execute() + //panicAtHttpError(err, httpResp) + // + //expectedSearchAttributeIntReset := iwfidl.SearchAttribute{ + // Key: iwfidl.PtrString(locking.TestSearchAttributeIntKey), + // ValueType: ptr.Any(iwfidl.INT), + // IntegerValue: iwfidl.PtrInt64(finalCounterValue), + //} + //assertions.Equal([]iwfidl.SearchAttribute{expectedSearchAttributeIntReset}, searchResultReset.GetSearchAttributes()) + + //reset here without update reapply and counter should be less } diff --git a/iwf-idl b/iwf-idl index 75978e48..a6fbd8fe 160000 --- a/iwf-idl +++ b/iwf-idl @@ -1 +1 @@ -Subproject commit 75978e48d6a929a2bb761e5c8f67d6caac99d658 +Subproject commit a6fbd8feb427fdf77b7ddc0f7c9d7eb154c385e7