Files
Aether/backend/internal/gc/gc_test.go
T
HoneyandClaude Opus 5 31a027c93a feat(aether): initial commit – self-hosted Cloud, Phasen 1–7
Go-Backend (chi, pgx, golang-migrate) + React/TS-Frontend als PWA.
Enthalten: Auth inkl. OIDC, Dateien mit Versionen und Papierkorb,
Freigaben (Links + intern), WebDAV, Gruppenordner, Admin/Theming,
Volltextsuche mit OCR, eigener PDF-Betrachter und WOPI-Office
(Collabora/OnlyOffice).

Nicht im Repo: deploy/.env (Sitzungsschlüssel, DB- und Admin-Passwort)
sowie alle Daten- und Build-Verzeichnisse – siehe .gitignore.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-24 09:25:36 +02:00

29 lines
838 B
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package gc
import "testing"
// Die Notbremse ist die letzte Verteidigungslinie: Hinter ihr löscht der GC
// echte Nutzerdateien. Eine kaputte Abfrage oder eine Verbindung zur falschen
// Datenbank sieht von hier aus exakt wie "alles ist verwaist" aus.
func TestShouldAbort(t *testing.T) {
tests := []struct {
name string
referenced int
scanned int
want bool
}{
{"database knows nothing but storage is full", 0, 500, true},
{"fresh install – nothing anywhere", 0, 0, false},
{"normal run", 120, 125, false},
{"single orphan among many", 1, 2, false},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := shouldAbort(tt.referenced, tt.scanned); got != tt.want {
t.Errorf("shouldAbort(%d, %d) = %v, want %v",
tt.referenced, tt.scanned, got, tt.want)
}
})
}
}