Optimize backend search and evaluation pipeline
build-push / docker (push) Has been cancelled

This commit is contained in:
AI Assistant
2026-03-16 16:13:43 +09:00
parent c5f6c611ec
commit 60fdd7842c
7 changed files with 371 additions and 10 deletions
+28
View File
@@ -4,6 +4,7 @@ import (
"encoding/base64"
"strings"
"testing"
"time"
)
func TestExtractVideoPreviewURLFindsEnvatoPreview(t *testing.T) {
@@ -113,3 +114,30 @@ func TestGeminiCandidateLimitNeverExceedsCandidates(t *testing.T) {
t.Fatalf("expected Gemini limit to stay within candidate count, got %d", got)
}
}
func TestLimitCollectorQueriesUsesSmallerBudgetForMissingPass(t *testing.T) {
queries := []string{"a", "b", "c", "d"}
got := limitCollectorQueries("Artgrid", queries, true)
if len(got) != 2 {
t.Fatalf("expected 2 queries for missing-pass Artgrid collector, got %d", len(got))
}
got = limitCollectorQueries("Google Video", queries, false)
if len(got) != 2 {
t.Fatalf("expected 2 queries for Google Video collector, got %d", len(got))
}
}
func TestSearchServiceFetchCacheRoundTrip(t *testing.T) {
service := NewSearchService("http://example.com", "", "")
service.setCachedFetchResult("html\nhttps://example.com/item", "<html></html>", time.Minute)
body, ok := service.getCachedFetchResult("html\nhttps://example.com/item")
if !ok {
t.Fatal("expected cached fetch result")
}
if body != "<html></html>" {
t.Fatalf("unexpected cached body: %q", body)
}
}