forked from longtao.wu/droboticflow
48 lines
1.4 KiB
Go
48 lines
1.4 KiB
Go
package api
|
|
|
|
import (
|
|
"context"
|
|
"droboticflow/internal/domain"
|
|
"droboticflow/internal/store"
|
|
"fmt"
|
|
"testing"
|
|
)
|
|
|
|
type continuationReadBudgetStore struct {
|
|
store.Store
|
|
batchPages int
|
|
}
|
|
|
|
func (s *continuationReadBudgetStore) ListHumanBatchAccessRecords(ctx context.Context, org string, ids []string) ([]domain.HumanBatchRecord, error) {
|
|
s.batchPages++
|
|
return s.Store.ListHumanBatchAccessRecords(ctx, org, ids)
|
|
}
|
|
func TestReviewContinuationDoesNotScanAnnotationBacklog(t *testing.T) {
|
|
f := decisionFixture(t)
|
|
f.item.AssignedUserID = ""
|
|
f.item.Status = domain.HumanItemSubmitted
|
|
f.item.CreatedAt = "2026-01-01T00:00:00Z"
|
|
if err := f.store.UpsertHumanItem(f.ctx, f.item); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
for i := 0; i < 350; i++ {
|
|
item := f.item
|
|
item.ID = fmt.Sprintf("annotation-backlog-%04d", i)
|
|
item.LegacyTaskID = ""
|
|
item.CurrentStageID = domain.FanyuV58StageAnnotationCombined
|
|
item.CreatedAt = "2020-01-01T00:00:00Z"
|
|
if err := f.store.UpsertHumanItem(f.ctx, item); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
wrapped := &continuationReadBudgetStore{Store: f.store}
|
|
f.handler = NewHandler(wrapped, nil)
|
|
result := continuationResult(t, continuationCall(f, "start", "bounded-queue", 0, nil, nil))
|
|
if result.Item == nil || result.Item.ID != f.item.ID {
|
|
t.Fatalf("wrong next item: %+v", result.Item)
|
|
}
|
|
if wrapped.batchPages > 1 {
|
|
t.Fatalf("next review scanned annotation backlog: %d batch pages, want 1", wrapped.batchPages)
|
|
}
|
|
}
|