183
184
// TestBasicVisibilityTimeSkew test
186
>
testNamespaceUUID := namespace.ID(uuid.NewString())
187
>
188
>
startTime := time.Now()
189
>
openRecord := s.createOpenWorkflowRecord(
190
>
testNamespaceUUID,
191
>
"visibility-workflow-test-time-skew",
192
>
"visibility-workflow",
193
>
startTime,
194
>
startTime,
195
>
"test-queue",
196
>
)
197
>
198
>
// ListOpenWorkflowExecutions
199
>
resp, err1 := s.VisibilityMgr.ListWorkflowExecutions(s.ctx, &manager.ListWorkflowExecutionsRequestV2{
200
>
NamespaceID: testNamespaceUUID,
201
>
PageSize: 1,
202
>
Query: fmt.Sprintf("%s >= '%s' AND %s <= '%s' AND %s = '%s'",
203
>
sadefs.StartTime,
204
>
startTime.Format(time.RFC3339Nano),
205
>
sadefs.StartTime,
206
>
startTime.Format(time.RFC3339Nano),
207
>
sadefs.ExecutionStatus,
208
>
enumspb.WORKFLOW_EXECUTION_STATUS_RUNNING,
209
>
),
210
>
})
211
>
s.NoError(err1)
212
>
s.Len(resp.Executions, 1)
213
>
s.assertOpenExecutionEquals(openRecord, resp.Executions[0])
214
>
215
>
closedRecord := s.createClosedWorkflowRecord(
216
>
openRecord,
217
>
startTime.Add(-10*time.Millisecond),
218
>
enumspb.WORKFLOW_EXECUTION_STATUS_COMPLETED,
219
>
)
220
>
221
>
// ListOpenWorkflowExecutions
222
>
resp, err3 := s.VisibilityMgr.ListWorkflowExecutions(s.ctx, &manager.ListWorkflowExecutionsRequestV2{
223
>
NamespaceID: testNamespaceUUID,
224
>
PageSize: 1,
225
>
Query: fmt.Sprintf("%s >= '%s' AND %s <= '%s' AND %s = '%s'",
226
>
sadefs.StartTime,
227
>
startTime.Format(time.RFC3339Nano),
228
>
sadefs.StartTime,
229
>
startTime.Format(time.RFC3339Nano),
230
>
sadefs.ExecutionStatus,
231
>
enumspb.WORKFLOW_EXECUTION_STATUS_RUNNING,
232
>
),
233
>
})
234
>
s.NoError(err3)
235
>
s.Empty(resp.Executions)
236
>
237
>
// ListClosedWorkflowExecutions
238
>
resp, err4 := s.VisibilityMgr.ListWorkflowExecutions(s.ctx, &manager.ListWorkflowExecutionsRequestV2{
239
>
NamespaceID: testNamespaceUUID,
240
>
PageSize: 1,
241
>
Query: fmt.Sprintf("%s >= '%s' AND %s <= '%s' AND %s != '%s'",
242
>
sadefs.CloseTime,
243
>
startTime.Add(-10*time.Millisecond).Format(time.RFC3339Nano),
244
>
sadefs.CloseTime,
245
>
startTime.Add(-10*time.Millisecond).Format(time.RFC3339Nano),
246
>
sadefs.ExecutionStatus,
247
>
enumspb.WORKFLOW_EXECUTION_STATUS_RUNNING,
248
>
),
249
>
})
250
>
s.NoError(err4)
251
>
s.Len(resp.Executions, 1)
252
>
s.assertClosedExecutionEquals(closedRecord, resp.Executions[0])
253
>
}
254
255
func (s *VisibilityPersistenceSuite) TestBasicVisibilityShortWorkflow() {