Drop one-shot tmp/axe scripts and agent i18n scratch so the Gitea tree is deployable.
46 lines
1.1 KiB
Go
46 lines
1.1 KiB
Go
package processing
|
|
|
|
import (
|
|
"errors"
|
|
"testing"
|
|
)
|
|
|
|
func TestReportOrphanProcessedNilPool(t *testing.T) {
|
|
_, err := ReportOrphanProcessed(t.Context(), nil)
|
|
if err == nil {
|
|
t.Fatal("expected error for nil pool")
|
|
}
|
|
}
|
|
|
|
func TestCleanupOrphanProcessedNilPool(t *testing.T) {
|
|
_, err := CleanupOrphanProcessed(t.Context(), nil, false)
|
|
if err == nil {
|
|
t.Fatal("expected error for nil pool")
|
|
}
|
|
}
|
|
|
|
func TestOrphanProcessedWhereCoversMissingAndUnprocessed(t *testing.T) {
|
|
// Lock the predicate text so ops SQL in the package comment stays aligned.
|
|
want := `
|
|
p.raw_product_id IS NULL
|
|
OR r.id IS NULL
|
|
OR r.processing_status = 'unprocessed'
|
|
OR r.is_processed = false`
|
|
if orphanProcessedWhere != want {
|
|
t.Fatalf("orphanProcessedWhere drifted:\n%s\nwant:\n%s", orphanProcessedWhere, want)
|
|
}
|
|
}
|
|
|
|
func TestOrphanCleanupClientErrors(t *testing.T) {
|
|
t.Parallel()
|
|
for _, err := range []error{ErrOrphanCleanupEmpty, ErrOrphanCleanupA1Protected} {
|
|
msg, ok := ClientError(err)
|
|
if !ok || msg == "" {
|
|
t.Fatalf("ClientError(%v) = %q, %v", err, msg, ok)
|
|
}
|
|
if !errors.Is(err, err) {
|
|
t.Fatal("sentinel identity broken")
|
|
}
|
|
}
|
|
}
|