feat: Enhance testing framework by adding new PDF files for count-api latency tests, updating .gitignore to include additional CSV reports, and refining documentation for improved clarity on test results and methodologies.
This commit is contained in:
+30
-17
@@ -3,6 +3,7 @@ package pipeline
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
@@ -13,20 +14,32 @@ import (
|
||||
func testPDFDir(t *testing.T) string {
|
||||
t.Helper()
|
||||
if d := os.Getenv("COUNT_TEST_PDF_DIR"); d != "" {
|
||||
return d
|
||||
}
|
||||
// services/services-count-facturas-medicas-serving → docs/plan_pruebas/data
|
||||
candidates := []string{
|
||||
filepath.Join("..", "..", "..", "..", "docs", "plan_pruebas", "data"),
|
||||
filepath.Join("..", "..", "..", "docs", "plan_pruebas", "data"),
|
||||
}
|
||||
for _, c := range candidates {
|
||||
abs, err := filepath.Abs(c)
|
||||
if err != nil {
|
||||
continue
|
||||
if st, err := os.Stat(d); err == nil && st.IsDir() {
|
||||
return d
|
||||
}
|
||||
if st, err := os.Stat(abs); err == nil && st.IsDir() {
|
||||
return abs
|
||||
t.Fatalf("COUNT_TEST_PDF_DIR=%s not a directory", d)
|
||||
}
|
||||
|
||||
var starts []string
|
||||
if _, file, _, ok := runtime.Caller(0); ok {
|
||||
starts = append(starts, filepath.Dir(file))
|
||||
}
|
||||
if wd, err := os.Getwd(); err == nil {
|
||||
starts = append(starts, wd)
|
||||
}
|
||||
|
||||
for _, start := range starts {
|
||||
dir := start
|
||||
for i := 0; i < 8; i++ {
|
||||
candidate := filepath.Join(dir, "docs", "plan_pruebas", "data")
|
||||
if st, err := os.Stat(candidate); err == nil && st.IsDir() {
|
||||
return candidate
|
||||
}
|
||||
parent := filepath.Dir(dir)
|
||||
if parent == dir {
|
||||
break
|
||||
}
|
||||
dir = parent
|
||||
}
|
||||
}
|
||||
return ""
|
||||
@@ -54,7 +67,7 @@ func listFixturePDFs(t *testing.T, dir string) []string {
|
||||
func TestProcessPDFTimingFixtures(t *testing.T) {
|
||||
dir := testPDFDir(t)
|
||||
if dir == "" {
|
||||
t.Skip("PDF fixtures not found; set COUNT_TEST_PDF_DIR")
|
||||
t.Skip("PDF fixtures not found; set COUNT_TEST_PDF_DIR to docs/plan_pruebas/data")
|
||||
}
|
||||
pdfs := listFixturePDFs(t, dir)
|
||||
if len(pdfs) == 0 {
|
||||
@@ -68,9 +81,9 @@ func TestProcessPDFTimingFixtures(t *testing.T) {
|
||||
defer engine.Close()
|
||||
|
||||
proc := NewProcessor(nil, engine, Options{
|
||||
DPI: 200, // faster than 300 for timing smoke
|
||||
DBSCANEps: 10,
|
||||
DBSCANMinSamples: 1,
|
||||
DPI: 200,
|
||||
DBSCANEps: 10,
|
||||
DBSCANMinSamples: 1,
|
||||
LogPipelineTiming: true,
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user