fix(PROJ-74): Test-/Vet-Signatur-Drift beheben, go build/vet/test wieder grün

archivmail-export nutzte noch die alte storage.New(path string)-Signatur
statt storage.Config (fehlender Keyfile/Compress hätte Rohbytes statt
Klartext-EML exportiert). Toten Self-Assignment-Code in storage.go entfernt.
Testdateien (storage, audit, api, userstore, auth) an aktuelle Signaturen
angeglichen; auth-Tests liefen bisher gegen einen SQLite-Pfad statt Postgres-
DSN und wurden auf das TEST_DATABASE_URL-Schema-Isolationsmuster der übrigen
Pakete umgestellt. api_test.go las den Login-Token noch aus dem JSON-Body
statt aus dem httpOnly-Cookie (Auth-Contract-Drift).

TestParseMissingDate an tatsächliches Verhalten angepasst: der Parser lässt
das Datum bewusst als Zero-Value, der time.Now()-Fallback sitzt in der
Storage-Schicht — damit bleibt nachvollziehbar ob ein Datum aus der Mail
stammt oder vom Archiv gesetzt wurde (GoBD).

Verifiziert auf 192.168.1.132: go build/vet/test ./... komplett grün,
kein Skip (Postgres + Manticore erreichbar).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019j28kGcaJAhBnrYX34hGdt
This commit is contained in:
sysops
2026-08-05 14:07:46 +02:00
co-authored by Claude Sonnet 5
parent 88cdc3eb3e
commit 075afa005a
11 changed files with 247 additions and 34 deletions
+5 -4
View File
@@ -4,6 +4,7 @@ import (
"bufio"
"context"
"encoding/json"
"io"
"log/slog"
"os"
"path/filepath"
@@ -75,7 +76,7 @@ func newTestAudit(t *testing.T) *audit.Logger {
}
schemaDSN := dsn + sep + "search_path=" + schema
logger := slog.New(slog.NewTextHandler(os.Discard, nil))
logger := slog.New(slog.NewTextHandler(io.Discard, nil))
l, err := audit.New(schemaDSN, t.TempDir(), logger)
if err != nil {
t.Fatalf("audit.New: %v", err)
@@ -218,7 +219,7 @@ func TestQueryPagination(t *testing.T) {
// DELETE on audit_log through the normal application connection.
func TestImmutableTrigger(t *testing.T) {
dsn, schemaDSN := testDSN(t)
logger := slog.New(slog.NewTextHandler(os.Discard, nil))
logger := slog.New(slog.NewTextHandler(io.Discard, nil))
l, err := audit.New(schemaDSN, t.TempDir(), logger)
if err != nil {
t.Fatalf("audit.New: %v", err)
@@ -255,7 +256,7 @@ func TestImmutableTrigger(t *testing.T) {
func TestFileLogging(t *testing.T) {
_, schemaDSN := testDSN(t)
logPath := filepath.Join(t.TempDir(), "audit.log")
logger := slog.New(slog.NewTextHandler(os.Discard, nil))
logger := slog.New(slog.NewTextHandler(io.Discard, nil))
l, err := audit.New(schemaDSN, logPath, logger)
if err != nil {
t.Fatalf("audit.New: %v", err)
@@ -297,7 +298,7 @@ func TestFileLoggingUnwritableContinues(t *testing.T) {
_, schemaDSN := testDSN(t)
// A directory cannot be opened for writing → file logging disabled.
logPath := t.TempDir()
logger := slog.New(slog.NewTextHandler(os.Discard, nil))
logger := slog.New(slog.NewTextHandler(io.Discard, nil))
l, err := audit.New(schemaDSN, logPath, logger)
if err != nil {
t.Fatalf("audit.New should not fail on unwritable path: %v", err)