Erster Schritt des golangci-lint-Rollouts (non-blocking): 44 misspell + 4 staticcheck automatisch behoben (32 Dateien, nur Tippfehler/mechanisch). build+test grün. Kein Runtime-Change → kein Deploy. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
20 lines
776 B
Go
20 lines
776 B
Go
package database
|
|
|
|
import "testing"
|
|
|
|
// TestEmbeddedMigrationsUnique guards against duplicate migration
|
|
// version prefixes. mail-gateway hit this on 2026-05-08 when two
|
|
// parallel agents both committed a 0092_*.sql; goose panicked at
|
|
// startup, the API restart-looped, the cluster rolling-upgrade hung.
|
|
//
|
|
// Cheap assertion that runs as part of `go test ./...` — fails the
|
|
// build before `make deb` ever produces an artifact, so the bad
|
|
// version never reaches the APT registry. Same logic also runs at
|
|
// service start via Migrate() and via `edgeguard-ctl migrate check`
|
|
// in postinst (defense in depth).
|
|
func TestEmbeddedMigrationsUnique(t *testing.T) {
|
|
if err := ValidateMigrations(); err != nil {
|
|
t.Fatalf("embedded migrations failed validation: %v", err)
|
|
}
|
|
}
|