Files
ARTEX/db/task_source_limit_test.go
T
pphua 9793b522d9 feat(tasks): add inherited context and resilient LLM execution
Add read-only task context inheritance, ordered task-level LLM failover, live Worker controls, cascading task cleanup, FIFO task concurrency, cancellation diagnostics, UI updates, tests, build script, and changelog.
2026-08-20 18:34:24 +08:00

21 lines
636 B
Go

package db
import (
"strings"
"testing"
)
func TestCreateTaskRejectsTooManySourcesBeforeOpeningTransaction(t *testing.T) {
sourceIDs := make([]int64, MaxTaskSourceCount+1)
for i := range sourceIDs {
sourceIDs[i] = int64(i + 1)
}
// No database handle is needed: validation must run before Begin so an
// oversized request cannot consume a connection or create partial rows.
_, err := (&DB{}).CreateTaskWithOptions("child", "goal", TaskCreateOptions{SourceTaskIDs: sourceIDs})
if err == nil || !strings.Contains(err.Error(), "too many source tasks") {
t.Fatalf("expected source-count validation error, got %v", err)
}
}