1189
}
1190
1191
>
func (s *visibilitySuite) TestSelect_MinStartTime_MaxStartTime_StatusCloseByType_Single() {
visibility.go
1192
>
for _, status := range testVisibilityCloseStatus {
1193
>
s.testSelectMinStartTimeMaxStartTimeStatusCloseByTypeSingle(status)
1194
>
}
1195
}
1196
1197
func (s *visibilitySuite) testSelectMinStartTimeMaxStartTimeStatusCloseByTypeSingle(
1198
status enumspb.WorkflowExecutionStatus,
1200
>
pageSize := 1
1201
>
1202
>
namespaceID := primitives.NewUUID()
1203
>
runID := primitives.NewUUID()
1204
>
workflowTypeName := shuffle.String(testVisibilityWorkflowTypeName)
1205
>
workflowID := shuffle.String(testVisibilityWorkflowID)
1206
>
startTime := s.now()
1207
>
executionTime := startTime.Add(time.Second)
1208
>
closeTime := executionTime.Add(time.Second)
1209
>
historyLength := rand.Int63()
1210
>
1211
>
visibility := s.newRandomVisibilityRow(
1212
>
namespaceID,
1213
>
runID,
1214
>
workflowTypeName,
1215
>
workflowID,
1216
>
startTime,
1217
>
executionTime,
1218
>
int32(status),
1219
>
new(closeTime),
1220
>
new(historyLength),
1221
>
)
1222
>
result, err := s.store.ReplaceIntoVisibility(newVisibilityContext(), &visibility)
1223
>
s.NoError(err)
1224
>
rowsAffected, err := result.RowsAffected()
1225
>
s.NoError(err)
1226
>
s.Equal(1, int(rowsAffected))
1227
>
1228
>
minStartTime := closeTime
1229
>
maxStartTime := closeTime
1230
>
selectFilter := sqlplugin.VisibilitySelectFilter{
1231
>
NamespaceID: namespaceID.String(),
1232
>
WorkflowID: nil,
1233
>
RunID: new(""),
1234
>
WorkflowTypeName: new(workflowTypeName),
1235
>
MinTime: new(minStartTime),
1236
>
MaxTime: new(maxStartTime),
1237
>
Status: int32(status),
1238
>
PageSize: new(pageSize),
1239
>
}
1240
>
rows, err := s.store.SelectFromVisibility(newVisibilityContext(), selectFilter)
1241
>
s.NoError(err)
1242
>
for index := range rows {
1243
>
rows[index].NamespaceID = namespaceID.String()
1244
>
}
1245
>
s.Equal([]sqlplugin.VisibilityRow{visibility}, rows)
1246
}
1247