@@ -114,64 +114,6 @@ func (s *taskAckManagerSuite) TearDownTest() {
114
114
s .mockShard .Finish (s .T ())
115
115
}
116
116
117
- func (s * taskAckManagerSuite ) TestGetPaginationFunc () {
118
- firstEventID := int64 (0 )
119
- nextEventID := int64 (1 )
120
- var branchToken []byte
121
- shardID := 0
122
- historyCount := 0
123
- pagingFunc := s .ackManager .getPaginationFunc (context .Background (), firstEventID , nextEventID , branchToken , shardID , & historyCount )
124
-
125
- pageToken := []byte {1 }
126
- event := & types.HistoryEvent {
127
- ID : 1 ,
128
- }
129
- s .mockHistoryMgr .On ("ReadHistoryBranch" , mock .Anything , mock .Anything ).Return (& persistence.ReadHistoryBranchResponse {
130
- HistoryEvents : []* types.HistoryEvent {event },
131
- NextPageToken : pageToken ,
132
- Size : 1 ,
133
- LastFirstEventID : 1 ,
134
- }, nil )
135
- events , token , err := pagingFunc (nil )
136
- s .NoError (err )
137
- s .Equal (pageToken , token )
138
- s .Len (events , 1 )
139
- s .Equal (events [0 ].(* types.HistoryEvent ), event )
140
- s .Equal (historyCount , 1 )
141
- }
142
-
143
- func (s * taskAckManagerSuite ) TestGetAllHistory_OK () {
144
- firstEventID := int64 (0 )
145
- nextEventID := int64 (1 )
146
- var branchToken []byte
147
- event := & types.HistoryEvent {
148
- ID : 1 ,
149
- }
150
-
151
- s .mockHistoryMgr .On ("ReadHistoryBranch" , mock .Anything , mock .Anything ).Return (& persistence.ReadHistoryBranchResponse {
152
- HistoryEvents : []* types.HistoryEvent {event },
153
- NextPageToken : nil ,
154
- Size : 1 ,
155
- LastFirstEventID : 1 ,
156
- }, nil )
157
-
158
- history , err := s .ackManager .getAllHistory (context .Background (), firstEventID , nextEventID , branchToken )
159
- s .NoError (err )
160
- s .Len (history .GetEvents (), 1 )
161
- s .Equal (event , history .GetEvents ()[0 ])
162
- }
163
-
164
- func (s * taskAckManagerSuite ) TestGetAllHistory_Error () {
165
- firstEventID := int64 (0 )
166
- nextEventID := int64 (1 )
167
- var branchToken []byte
168
- s .mockHistoryMgr .On ("ReadHistoryBranch" , mock .Anything , mock .Anything ).Return (nil , errors .New ("test" ))
169
-
170
- history , err := s .ackManager .getAllHistory (context .Background (), firstEventID , nextEventID , branchToken )
171
- s .Error (err )
172
- s .Nil (history )
173
- }
174
-
175
117
func (s * taskAckManagerSuite ) TestReadTasksWithBatchSize_OK () {
176
118
task := & persistence.ReplicationTaskInfo {
177
119
DomainID : uuid .New (),
@@ -197,86 +139,6 @@ func (s *taskAckManagerSuite) TestReadTasksWithBatchSize_Error() {
197
139
s .Len (taskInfo , 0 )
198
140
}
199
141
200
- func (s * taskAckManagerSuite ) TestIsNewRunNDCEnabled_True () {
201
- domainID := uuid .New ()
202
- workflowID := uuid .New ()
203
- runID := uuid .New ()
204
- workflowContext , release , _ := s .ackManager .executionCache .GetOrCreateWorkflowExecutionForBackground (
205
- domainID ,
206
- types.WorkflowExecution {
207
- WorkflowID : workflowID ,
208
- RunID : runID ,
209
- },
210
- )
211
- workflowContext .SetWorkflowExecution (s .mockMutableState )
212
- release (nil )
213
-
214
- s .mockMutableState .EXPECT ().StartTransaction (gomock .Any (), gomock .Any ()).Return (false , nil ).Times (1 )
215
- s .mockMutableState .EXPECT ().IsWorkflowExecutionRunning ().Return (false ).AnyTimes ()
216
- s .mockMutableState .EXPECT ().GetVersionHistories ().Return (& persistence.VersionHistories {})
217
- s .mockDomainCache .EXPECT ().GetDomainByID (domainID ).Return (cache .NewGlobalDomainCacheEntryForTest (
218
- & persistence.DomainInfo {ID : domainID , Name : "domainName" },
219
- & persistence.DomainConfig {Retention : 1 },
220
- & persistence.DomainReplicationConfig {
221
- ActiveClusterName : cluster .TestCurrentClusterName ,
222
- Clusters : []* persistence.ClusterReplicationConfig {
223
- {ClusterName : cluster .TestCurrentClusterName },
224
- {ClusterName : cluster .TestAlternativeClusterName },
225
- },
226
- },
227
- 1 ,
228
- ), nil ).AnyTimes ()
229
-
230
- isNDC , err := s .ackManager .isNewRunNDCEnabled (
231
- context .Background (),
232
- domainID ,
233
- workflowID ,
234
- runID ,
235
- )
236
- s .NoError (err )
237
- s .True (isNDC )
238
- }
239
-
240
- func (s * taskAckManagerSuite ) TestIsNewRunNDCEnabled_False () {
241
- domainID := uuid .New ()
242
- workflowID := uuid .New ()
243
- runID := uuid .New ()
244
- workflowContext , release , _ := s .ackManager .executionCache .GetOrCreateWorkflowExecutionForBackground (
245
- domainID ,
246
- types.WorkflowExecution {
247
- WorkflowID : workflowID ,
248
- RunID : runID ,
249
- },
250
- )
251
- workflowContext .SetWorkflowExecution (s .mockMutableState )
252
- release (nil )
253
-
254
- s .mockMutableState .EXPECT ().StartTransaction (gomock .Any (), gomock .Any ()).Return (false , nil ).Times (1 )
255
- s .mockMutableState .EXPECT ().IsWorkflowExecutionRunning ().Return (false ).AnyTimes ()
256
- s .mockMutableState .EXPECT ().GetVersionHistories ().Return (nil )
257
- s .mockDomainCache .EXPECT ().GetDomainByID (domainID ).Return (cache .NewGlobalDomainCacheEntryForTest (
258
- & persistence.DomainInfo {ID : domainID , Name : "domainName" },
259
- & persistence.DomainConfig {Retention : 1 },
260
- & persistence.DomainReplicationConfig {
261
- ActiveClusterName : cluster .TestCurrentClusterName ,
262
- Clusters : []* persistence.ClusterReplicationConfig {
263
- {ClusterName : cluster .TestCurrentClusterName },
264
- {ClusterName : cluster .TestAlternativeClusterName },
265
- },
266
- },
267
- 1 ,
268
- ), nil ).AnyTimes ()
269
-
270
- isNDC , err := s .ackManager .isNewRunNDCEnabled (
271
- context .Background (),
272
- domainID ,
273
- workflowID ,
274
- runID ,
275
- )
276
- s .NoError (err )
277
- s .False (isNDC )
278
- }
279
-
280
142
func (s * taskAckManagerSuite ) TestGetVersionHistoryItems_Error () {
281
143
_ , _ , err := getVersionHistoryItems (nil , 0 , 0 )
282
144
s .Error (err )
0 commit comments