feat: harden loose-offline sync for user JWT, schema, and console ops
Enable Binding-scoped agent push/pull, empty-table schema ensure, SyncPage inspect/drop-table, default module import, and agent-bound publish docs from the 宇恒联调意见. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
31
platform/internal/dbsync/dialect_test.go
Normal file
31
platform/internal/dbsync/dialect_test.go
Normal file
@@ -0,0 +1,31 @@
|
||||
package dbsync
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestNormalizeSQLiteDSN(t *testing.T) {
|
||||
got := normalizeSQLiteDSN(`file:E:\data\remote.db`)
|
||||
if got != "file:E:/data/remote.db?_pragma=busy_timeout(5000)" {
|
||||
t.Fatalf("got %q", got)
|
||||
}
|
||||
got = normalizeSQLiteDSN(`E:\data\remote.db`)
|
||||
if got != "file:E:/data/remote.db?_pragma=busy_timeout(5000)" {
|
||||
t.Fatalf("bare path got %q", got)
|
||||
}
|
||||
got = normalizeSQLiteDSN(`file:E:/data/remote.db?_pragma=foreign_keys(1)`)
|
||||
if got != "file:E:/data/remote.db?_pragma=foreign_keys(1)&_pragma=busy_timeout(5000)" {
|
||||
t.Fatalf("keep query got %q", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestIsRetryable(t *testing.T) {
|
||||
if !IsRetryable(Retryable("x")) {
|
||||
t.Fatal("expected retryable")
|
||||
}
|
||||
if IsRetryable(fmtError("plain")) {
|
||||
t.Fatal("plain should not")
|
||||
}
|
||||
}
|
||||
|
||||
type fmtError string
|
||||
|
||||
func (e fmtError) Error() string { return string(e) }
|
||||
Reference in New Issue
Block a user