diff --git a/cmd/server/go.mod b/cmd/server/go.mod index cbfe79b314a..694c3a7eb1e 100644 --- a/cmd/server/go.mod +++ b/cmd/server/go.mod @@ -38,7 +38,7 @@ require ( github.com/robfig/cron v1.2.0 // indirect github.com/sirupsen/logrus v1.9.0 // indirect github.com/startreedata/pinot-client-go v0.2.0 // latest release supports pinot v0.12.0 which is also internal version - github.com/stretchr/testify v1.8.3 + github.com/stretchr/testify v1.9.0 github.com/uber-go/tally v3.3.15+incompatible // indirect github.com/uber/cadence-idl v0.0.0-20241126065313-57bd6876d48f github.com/uber/ringpop-go v0.8.5 // indirect @@ -135,7 +135,7 @@ require ( github.com/prometheus/procfs v0.6.0 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect - github.com/stretchr/objx v0.5.0 // indirect + github.com/stretchr/objx v0.5.2 // indirect github.com/uber-common/bark v1.2.1 // indirect github.com/uber-go/mapdecode v1.0.0 // indirect github.com/urfave/cli/v2 v2.27.4 diff --git a/cmd/server/go.sum b/cmd/server/go.sum index 4068b9a149e..3c847ee28f7 100644 --- a/cmd/server/go.sum +++ b/cmd/server/go.sum @@ -386,8 +386,9 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= +github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= @@ -397,8 +398,8 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= -github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/uber-common/bark v1.2.1 h1:cREJ9b7CpTjwZr0/5wV82fXlitoCIEHHnt9WkQ4lIk0= github.com/uber-common/bark v1.2.1/go.mod h1:g0ZuPcD7XiExKHynr93Q742G/sbrdVQkghrqLGOoFuY= github.com/uber-go/mapdecode v1.0.0 h1:euUEFM9KnuCa1OBixz1xM+FIXmpixyay5DLymceOVrU= diff --git a/common/archiver/gcloud/go.mod b/common/archiver/gcloud/go.mod index c953f0fed90..f409bfa41c6 100644 --- a/common/archiver/gcloud/go.mod +++ b/common/archiver/gcloud/go.mod @@ -26,7 +26,7 @@ require ( github.com/pborman/uuid v0.0.0-20180906182336-adf5a7427709 // indirect github.com/robfig/cron v1.2.0 // indirect github.com/sirupsen/logrus v1.9.0 // indirect - github.com/stretchr/testify v1.8.3 + github.com/stretchr/testify v1.9.0 github.com/uber-go/tally v3.3.15+incompatible github.com/uber/ringpop-go v0.8.5 // indirect github.com/uber/tchannel-go v1.22.2 // indirect @@ -87,7 +87,7 @@ require ( github.com/prometheus/common v0.26.0 // indirect github.com/prometheus/procfs v0.6.0 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect - github.com/stretchr/objx v0.5.0 // indirect + github.com/stretchr/objx v0.5.2 // indirect github.com/uber-common/bark v1.2.1 // indirect github.com/uber-go/mapdecode v1.0.0 // indirect go.opencensus.io v0.24.0 // indirect diff --git a/common/archiver/gcloud/go.sum b/common/archiver/gcloud/go.sum index f5bcdf6c79b..065cf16c507 100644 --- a/common/archiver/gcloud/go.sum +++ b/common/archiver/gcloud/go.sum @@ -258,8 +258,9 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= +github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= @@ -268,8 +269,8 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= -github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/uber-common/bark v1.2.1 h1:cREJ9b7CpTjwZr0/5wV82fXlitoCIEHHnt9WkQ4lIk0= github.com/uber-common/bark v1.2.1/go.mod h1:g0ZuPcD7XiExKHynr93Q742G/sbrdVQkghrqLGOoFuY= github.com/uber-go/mapdecode v1.0.0 h1:euUEFM9KnuCa1OBixz1xM+FIXmpixyay5DLymceOVrU= diff --git a/go.mod b/go.mod index 08d9b00dd8f..9d7f70ad4ff 100644 --- a/go.mod +++ b/go.mod @@ -38,7 +38,7 @@ require ( github.com/robfig/cron v1.2.0 github.com/sirupsen/logrus v1.9.0 // indirect github.com/startreedata/pinot-client-go v0.2.0 // latest release supports pinot v0.12.0 which is also internal version - github.com/stretchr/testify v1.8.3 + github.com/stretchr/testify v1.9.0 github.com/uber-go/tally v3.3.15+incompatible github.com/uber/cadence-idl v0.0.0-20241126065313-57bd6876d48f github.com/uber/ringpop-go v0.8.5 @@ -67,7 +67,10 @@ require ( gopkg.in/yaml.v2 v2.3.0 ) -require github.com/google/gofuzz v1.0.0 +require ( + github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568 + github.com/google/gofuzz v1.0.0 +) require github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 // indirect @@ -122,7 +125,7 @@ require ( github.com/prometheus/procfs v0.6.0 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect - github.com/stretchr/objx v0.5.0 // indirect + github.com/stretchr/objx v0.5.2 // indirect github.com/uber-common/bark v1.2.1 // indirect github.com/uber-go/mapdecode v1.0.0 // indirect github.com/xdg-go/pbkdf2 v1.0.0 // indirect diff --git a/go.sum b/go.sum index a43394331d9..402d314550e 100644 --- a/go.sum +++ b/go.sum @@ -422,8 +422,9 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= +github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= @@ -433,8 +434,8 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= -github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/tidwall/pretty v1.0.0 h1:HsD+QiTn7sK6flMKIvNmpqz1qrpP3Ps6jOKIKMooyg4= github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= github.com/uber-common/bark v1.2.1 h1:cREJ9b7CpTjwZr0/5wV82fXlitoCIEHHnt9WkQ4lIk0= diff --git a/go.work.sum b/go.work.sum index 883fbe20f16..69f6e5fc8b0 100644 --- a/go.work.sum +++ b/go.work.sum @@ -559,7 +559,12 @@ github.com/spf13/afero v1.3.3 h1:p5gZEKLYoL7wh8VrJesMaYeNxdEd1v3cb4irOk9zB54= github.com/spf13/afero v1.3.3/go.mod h1:5KUK8ByomD5Ti5Artl0RtHeI5pTF7MIDuXL3yY520V4= github.com/spf13/cobra v0.0.3 h1:ZlrZ4XsMRm04Fr5pSFxBgfND2EBVa1nLpiy1stUsX/8= github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg= +github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= +github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/timl3136/cadence-idl v0.0.0-20240716221550-3529a2618736 h1:UoaE2FX56QyLA0VGMJ16cll3haA5aZaFnfw5ZFDBzVU= github.com/timl3136/cadence-idl v0.0.0-20240716221550-3529a2618736/go.mod h1:oyUK7GCNCRHCCyWyzifSzXpVrRYVBbAMHAzF5dXiKws= github.com/timl3136/cadence-idl v0.0.0-20240716224349-f9e143d54910 h1:cxtZkrE5AumMJDXFKVOUG+Q0GSHHM05t90/NKFdt+6E= diff --git a/tools/cli/app_test.go b/tools/cli/app_test.go index 83aa4b979ca..89ab5904679 100644 --- a/tools/cli/app_test.go +++ b/tools/cli/app_test.go @@ -29,11 +29,13 @@ import ( "testing" "time" + "github.com/flynn/go-shlex" "github.com/golang/mock/gomock" "github.com/olekukonko/tablewriter" "github.com/olivere/elastic" "github.com/pborman/uuid" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" "github.com/urfave/cli/v2" @@ -142,19 +144,29 @@ func (s *cliAppSuite) TearDownTest() { s.mockCtrl.Finish() // assert mock’s expectations } -func (s *cliAppSuite) testcaseHelper(testcases []testcase) { - for _, tt := range testcases { - s.T().Run(tt.name, func(t *testing.T) { - if tt.mock != nil { - tt.mock() - } - err := s.app.Run(strings.Split(tt.command, " ")) - if tt.err != "" { - assert.ErrorContains(t, err, tt.err) - } else { - assert.NoError(t, err) - } - }) +func (s *cliAppSuite) SetupSubTest() { + // this is required to re-establish mocks on subtest-level + // otherwise you will confusingly see expectations from previous test-cases on errors + s.SetupTest() +} + +func (s *cliAppSuite) TearDownSubTest() { + s.TearDownTest() +} + +func (s *cliAppSuite) runTestCase(tt testcase) { + if tt.mock != nil { + tt.mock() + } + + args, err := shlex.Split(tt.command) + require.NoError(s.T(), err) + err = s.app.Run(args) + + if tt.err != "" { + assert.ErrorContains(s.T(), err, tt.err) + } else { + assert.NoError(s.T(), err) } } diff --git a/tools/cli/domain_commands_test.go b/tools/cli/domain_commands_test.go index 3bef549c3e5..6cf74fe49f4 100644 --- a/tools/cli/domain_commands_test.go +++ b/tools/cli/domain_commands_test.go @@ -32,7 +32,7 @@ import ( ) func (s *cliAppSuite) TestDomainRegister() { - s.testcaseHelper([]testcase{ + testCases := []testcase{ { "local", "cadence --do test-domain domain register --global_domain false", @@ -131,7 +131,13 @@ func (s *cliAppSuite) TestDomainRegister() { "failed to parse", nil, }, - }) + } + + for _, tt := range testCases { + s.Run(tt.name, func() { + s.runTestCase(tt) + }) + } } func (s *cliAppSuite) TestDomainUpdate() { @@ -160,7 +166,7 @@ func (s *cliAppSuite) TestDomainUpdate() { }, } - s.testcaseHelper([]testcase{ + testCases := []testcase{ { "update nothing", "cadence --do test-domain domain update", @@ -271,11 +277,17 @@ func (s *cliAppSuite) TestDomainUpdate() { }).Return(nil, fmt.Errorf("update error")) }, }, - }) + } + + for _, tt := range testCases { + s.Run(tt.name, func() { + s.runTestCase(tt) + }) + } } func (s *cliAppSuite) TestListDomains() { - s.testcaseHelper([]testcase{ + testCases := []testcase{ { "list domains by default", "cadence admin domain list", @@ -296,5 +308,11 @@ func (s *cliAppSuite) TestListDomains() { }, nil) }, }, - }) + } + + for _, tt := range testCases { + s.Run(tt.name, func() { + s.runTestCase(tt) + }) + } } diff --git a/tools/cli/workflow_commands_test.go b/tools/cli/workflow_commands_test.go index 08d88daf397..36e455380c6 100644 --- a/tools/cli/workflow_commands_test.go +++ b/tools/cli/workflow_commands_test.go @@ -680,7 +680,7 @@ func Test_ResetWorkflow_Missing_RunID(t *testing.T) { } func (s *cliAppSuite) TestCompleteActivity() { - s.testcaseHelper([]testcase{ + testCases := []testcase{ { name: "happy", command: `cadence --do test-domain wf activity complete -w wid -r rid -aid 3 -result result --identity tester`, @@ -689,11 +689,17 @@ func (s *cliAppSuite) TestCompleteActivity() { s.serverFrontendClient.EXPECT().RespondActivityTaskCompletedByID(gomock.Any(), gomock.Any()).Return(nil) }, }, - }) + } + + for _, tt := range testCases { + s.Run(tt.name, func() { + s.runTestCase(tt) + }) + } } func (s *cliAppSuite) TestDescribeWorkflow() { - s.testcaseHelper([]testcase{ + testCases := []testcase{ { "happy", "cadence --do test-domain wf describe -w wid", @@ -718,11 +724,17 @@ func (s *cliAppSuite) TestDescribeWorkflow() { s.serverFrontendClient.EXPECT().DescribeWorkflowExecution(gomock.Any(), gomock.Any()).Return(resp, nil) }, }, - }) + } + + for _, tt := range testCases { + s.Run(tt.name, func() { + s.runTestCase(tt) + }) + } } func (s *cliAppSuite) TestFailActivity() { - s.testcaseHelper([]testcase{ + testCases := []testcase{ { name: "happy", command: `cadence --do test-domain wf activity fail -w wid -r rid -aid 3 --reason somereason --detail somedetail --identity tester`, @@ -731,11 +743,17 @@ func (s *cliAppSuite) TestFailActivity() { s.serverFrontendClient.EXPECT().RespondActivityTaskFailedByID(gomock.Any(), gomock.Any()).Return(nil) }, }, - }) + } + + for _, tt := range testCases { + s.Run(tt.name, func() { + s.runTestCase(tt) + }) + } } func (s *cliAppSuite) TestListAllWorkflow() { - s.testcaseHelper([]testcase{ + testCases := []testcase{ { name: "happy", command: `cadence --do test-domain wf listall`, @@ -745,11 +763,17 @@ func (s *cliAppSuite) TestListAllWorkflow() { s.serverFrontendClient.EXPECT().ListClosedWorkflowExecutions(gomock.Any(), gomock.Any()).Return(listClosedWorkflowExecutionsResponse, nil) }, }, - }) + } + + for _, tt := range testCases { + s.Run(tt.name, func() { + s.runTestCase(tt) + }) + } } func (s *cliAppSuite) TestQueryWorkflow() { - s.testcaseHelper([]testcase{ + testCases := []testcase{ { name: "happy", command: `cadence --do test-domain wf query -w wid -qt query-type-test`, @@ -872,11 +896,17 @@ func (s *cliAppSuite) TestQueryWorkflow() { command: "cadence wf query", err: "Required flag not found", }, - }) + } + + for _, tt := range testCases { + s.Run(tt.name, func() { + s.runTestCase(tt) + }) + } } func (s *cliAppSuite) TestResetWorkflow() { - s.testcaseHelper([]testcase{ + testCases := []testcase{ { name: "happy", command: `cadence --do test-domain wf reset -w wid -r rid -reason test-reason --event_id 1`, @@ -886,11 +916,17 @@ func (s *cliAppSuite) TestResetWorkflow() { s.serverFrontendClient.EXPECT().ResetWorkflowExecution(gomock.Any(), gomock.Any()).Return(resp, nil) }, }, - }) + } + + for _, tt := range testCases { + s.Run(tt.name, func() { + s.runTestCase(tt) + }) + } } func (s *cliAppSuite) TestScanAllWorkflow() { - s.testcaseHelper([]testcase{ + testCases := []testcase{ { name: "happy", command: `cadence --do test-domain wf scanall`, @@ -898,11 +934,17 @@ func (s *cliAppSuite) TestScanAllWorkflow() { s.serverFrontendClient.EXPECT().ScanWorkflowExecutions(gomock.Any(), gomock.Any()).Return(&types.ListWorkflowExecutionsResponse{}, nil) }, }, - }) + } + + for _, tt := range testCases { + s.Run(tt.name, func() { + s.runTestCase(tt) + }) + } } func (s *cliAppSuite) TestSignalWithStartWorkflowExecution() { - s.testcaseHelper([]testcase{ + testCases := []testcase{ { name: "happy", command: `cadence --do test-domain wf signalwithstart --et 100 --workflow_type sometype --tasklist tasklist -w wid -n signal-name --signal_input []`, @@ -924,7 +966,13 @@ func (s *cliAppSuite) TestSignalWithStartWorkflowExecution() { command: "cadence wf signalwithstart", err: "Required flag not found", }, - }) + } + + for _, tt := range testCases { + s.Run(tt.name, func() { + s.runTestCase(tt) + }) + } } func Test_DoReset(t *testing.T) {