253
}
254
256
>
testNamespaceUUID := namespace.ID(uuid.NewString())
257
>
258
>
startTime := time.Now().UTC()
259
>
openRecord := s.createOpenWorkflowRecord(
260
>
testNamespaceUUID,
261
>
"visibility-workflow-test-short-workflow",
262
>
"visibility-workflow",
263
>
startTime,
264
>
startTime,
265
>
"test-queue",
266
>
)
267
>
closedRecord := s.createClosedWorkflowRecord(
268
>
openRecord,
269
>
startTime.Add(10*time.Millisecond),
270
>
enumspb.WORKFLOW_EXECUTION_STATUS_COMPLETED,
271
>
)
272
>
273
>
// ListOpenWorkflowExecutions
274
>
resp, err3 := s.VisibilityMgr.ListWorkflowExecutions(s.ctx, &manager.ListWorkflowExecutionsRequestV2{
275
>
NamespaceID: testNamespaceUUID,
276
>
PageSize: 1,
277
>
Query: fmt.Sprintf("%s >= '%s' AND %s <= '%s' AND %s = '%s'",
278
>
sadefs.StartTime,
279
>
startTime.Format(time.RFC3339Nano),
280
>
sadefs.StartTime,
281
>
startTime.Format(time.RFC3339Nano),
282
>
sadefs.ExecutionStatus,
283
>
enumspb.WORKFLOW_EXECUTION_STATUS_RUNNING,
284
>
),
285
>
})
286
>
s.NoError(err3)
287
>
s.Empty(resp.Executions)
288
>
289
>
// ListClosedWorkflowExecutions
290
>
resp, err4 := s.VisibilityMgr.ListWorkflowExecutions(s.ctx, &manager.ListWorkflowExecutionsRequestV2{
291
>
NamespaceID: testNamespaceUUID,
292
>
PageSize: 1,
293
>
Query: fmt.Sprintf("%s >= '%s' AND %s <= '%s' AND %s != '%s'",
294
>
sadefs.CloseTime,
295
>
startTime.Add(10*time.Millisecond).Format(time.RFC3339Nano),
296
>
sadefs.CloseTime,
297
>
startTime.Add(10*time.Millisecond).Format(time.RFC3339Nano),
298
>
sadefs.ExecutionStatus,
299
>
enumspb.WORKFLOW_EXECUTION_STATUS_RUNNING,
300
>
),
301
>
})
302
>
s.NoError(err4)
303
>
s.Len(resp.Executions, 1)
304
>
s.assertClosedExecutionEquals(closedRecord, resp.Executions[0])
305
>
}
306
307
// TestVisibilityPagination test