Files
pages/internal/db/mysql_test.go
T
Anya Tokugawa 6a67fd9afe feat(storage): add native MySQL namespace and identity pilots
Add resumable checked migrations and explicit schema administration commands. Port ML budgets, namespaces, identity and group persistence with three-backend contracts. Keep MySQL unavailable as the full application backend.
2026-11-30 23:03:24 +09:00

21 lines
793 B
Go

package db
import (
"context"
"strings"
"testing"
)
func TestMySQLRejectsUnsafeConfiguration(t *testing.T) {
for _, dsn := range []string{"", "private-secret@bad", "u:private-secret@tcp(localhost:3306)/pages", "u:p@tcp(localhost:3306)/pages?tls=skip-verify", "u:p@tcp(localhost:3306)/pages?tls=preferred", "u:p@tcp(localhost:3306)/pages?tls=true&multiStatements=true", "u:p@tcp(localhost:3306)/pages?tls=true&allowAllFiles=true", "u:p@tcp(localhost:3306)/pages?tls=true&sql_mode=bad"} {
connection, err := OpenMySQL(context.Background(), MySQLOptions{DSN: dsn})
if connection != nil {
connection.Close()
t.Fatal("unexpected connection")
}
if err == nil || strings.Contains(err.Error(), "private-secret") {
t.Fatalf("configuration not safely rejected: %v", err)
}
}
}