Files
weichenandCursor be0c1e843f feat(dataset): registry, pause/resume backfill, destroy gates, eight tracks
批准 dataset 分类入库;SKIP LOCKED 分批;销毁默认 fail closed。restore 演练拒绝共享 env DSN。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-15 02:40:12 +00:00

36 lines
799 B
Go

package dataset
import (
"os"
"strings"
"testing"
)
func TestRestoreScriptRefusesSharedDSN(t *testing.T) {
raw, err := os.ReadFile(scriptPath(t))
if err != nil {
t.Fatal(err)
}
text := string(raw)
if strings.Contains(text, "5433/agent_system_dev") && strings.Contains(text, "TEST_DATABASE_URL:-postgres") {
t.Fatal("restore drill must not default to agent_system_dev")
}
if !strings.Contains(text, "agent_system_(dev|test|main)") {
t.Fatal("restore drill must refuse shared env database names")
}
}
func scriptPath(t *testing.T) string {
t.Helper()
for _, p := range []string{
"scripts/restore-system-db-drill.sh",
"../../scripts/restore-system-db-drill.sh",
} {
if _, err := os.Stat(p); err == nil {
return p
}
}
t.Fatal("restore script not found")
return ""
}