Files
edgeguard-native/internal/database/migrations_unique_test.go
Debian 02096c8ad8 chore(lint): golangci-lint --fix — misspell + staticcheck-Autofixes (Backlog 142→~98)
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>
2026-07-05 23:25:22 +02:00

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)
}
}