feat: build vehicle data platform and production pipeline

This commit is contained in:
lingniu
2026-07-14 12:35:33 +08:00
parent b452be3b94
commit bb59303a4b
270 changed files with 88016 additions and 1975 deletions

View File

@@ -0,0 +1,37 @@
package main
import (
"strings"
"testing"
"time"
)
func TestBuildCandidateInsertMatchesBatchArguments(t *testing.T) {
query, args := buildCandidateInsert(temporaryTable, 10, 13, time.Now())
if strings.Count(query, "(?,?,?,?,?,?,?)") != 3 || strings.Count(query, "?") != len(args) || len(args) != 21 {
t.Fatalf("query/args mismatch: placeholders=%d args=%d query=%s", strings.Count(query, "?"), len(args), query)
}
}
func TestBenchmarkConfigRequiresExplicitDurableConfirmation(t *testing.T) {
valid := benchmarkConfig{Rows: 100_000, BatchSize: 500, Mode: durableMode, ConfirmDurable: true}
if err := valid.validate(); err != nil {
t.Fatalf("valid durable benchmark rejected: %v", err)
}
valid.ConfirmDurable = false
if err := valid.validate(); err == nil || !strings.Contains(err.Error(), "--confirm-durable-write") {
t.Fatalf("durable mode must require confirmation, got %v", err)
}
}
func TestBenchmarkConfigBoundsAndModes(t *testing.T) {
for _, config := range []benchmarkConfig{
{Rows: 0, BatchSize: 500, Mode: temporaryMode},
{Rows: 1, BatchSize: 1001, Mode: temporaryMode},
{Rows: 1, BatchSize: 1, Mode: "business-table"},
} {
if err := config.validate(); err == nil {
t.Fatalf("invalid config accepted: %+v", config)
}
}
}