Skip to content

Commit 7f92111

Browse files
authored
Minor cleanup of a test file (#1071)
Just noticed some junk while reading. This test probably shouldn't be passing given the logs... but this rewrite does not change behavior.
1 parent f929adc commit 7f92111

File tree

1 file changed

+11
-35
lines changed

1 file changed

+11
-35
lines changed

test/replaytests/reply_test.go

Lines changed: 11 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -21,47 +21,23 @@
2121
package replaytests
2222

2323
import (
24+
"strings"
2425
"testing"
2526

26-
"github.com/golang/mock/gomock"
2727
"github.com/stretchr/testify/require"
28-
"github.com/stretchr/testify/suite"
29-
"go.uber.org/cadence/.gen/go/cadence/workflowservicetest"
3028
"go.uber.org/cadence/worker"
31-
"go.uber.org/zap"
29+
"go.uber.org/zap/zaptest"
3230
)
3331

34-
type replayTestSuite struct {
35-
suite.Suite
36-
mockCtrl *gomock.Controller
37-
service *workflowservicetest.MockClient
38-
}
39-
40-
func TestReplayTestSuite(t *testing.T) {
41-
s := new(replayTestSuite)
42-
suite.Run(t, s)
43-
}
44-
45-
func (s *replayTestSuite) SetupTest() {
46-
s.mockCtrl = gomock.NewController(s.T())
47-
s.service = workflowservicetest.NewMockClient(s.mockCtrl)
48-
}
49-
50-
func (s *replayTestSuite) TearDownTest() {
51-
s.mockCtrl.Finish() // assert mock’s expectations
52-
}
53-
54-
func (s *replayTestSuite) TestReplayWorkflowHistoryFromFile() {
55-
logger, _ := zap.NewDevelopment()
56-
testFiles := []string{"basic.json", "basic_new.json", "version.json", "version_new.json"}
57-
var err error
58-
59-
for _, testFile := range testFiles {
60-
replayer := worker.NewWorkflowReplayer()
61-
replayer.RegisterWorkflow(Workflow)
62-
replayer.RegisterWorkflow(Workflow2)
32+
func TestReplayWorkflowHistoryFromFile(t *testing.T) {
33+
for _, testFile := range []string{"basic.json", "basic_new.json", "version.json", "version_new.json"} {
34+
t.Run("replay_"+strings.Split(testFile, ".")[0], func(t *testing.T) {
35+
replayer := worker.NewWorkflowReplayer()
36+
replayer.RegisterWorkflow(Workflow)
37+
replayer.RegisterWorkflow(Workflow2)
6338

64-
err = replayer.ReplayWorkflowHistoryFromJSONFile(logger, testFile)
65-
require.NoError(s.T(), err)
39+
err := replayer.ReplayWorkflowHistoryFromJSONFile(zaptest.NewLogger(t), testFile)
40+
require.NoError(t, err)
41+
})
6642
}
6743
}

0 commit comments

Comments
 (0)