mirror of
https://github.com/Syngnat/GoNavi.git
synced 2026-08-21 08:22:44 +08:00
✨ feat(cli): 新增独立命令行与发布链
- 新增无头运行时及连接、查询、导出、批处理、审计和 MCP 命令 - 复用活动数据根、密文存储与跨进程锁,落实写入安全和取消语义 - 增加六平台 CLI 归档、独立校验和、Docker、npm 与 WinGet 分发 - 隔离 GUI/CLI 更新资产并强化 macOS 签名与公证门禁 - 补充并发、审计、事务及发布契约回归测试 Refs #902
This commit is contained in:
@@ -122,6 +122,39 @@ func TestExecuteSQLFileStreamRedactsBatchExecutionErrors(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestExecuteSQLFileStreamDoesNotContinueAfterUnknownWriteOutcome(t *testing.T) {
|
||||
database := &fakeSQLFileBatchDB{execError: func(query string) error {
|
||||
if strings.HasPrefix(query, "CREATE TABLE") {
|
||||
return db.MarkWriteOutcomeUnknown(errors.New("write response lost"))
|
||||
}
|
||||
return nil
|
||||
}}
|
||||
result, err := executeSQLFileStream(context.Background(), database, strings.NewReader("CREATE TABLE demo(id integer); INSERT INTO demo(id) VALUES (1);"), sqlFileExecutionOptions{
|
||||
DBType: "postgres",
|
||||
TransactionMode: sqlFileTransactionModeOff,
|
||||
ContinueOnError: true,
|
||||
}, nil)
|
||||
if err == nil || !result.OutcomeUnknown {
|
||||
t.Fatalf("unknown write result = %#v, err=%v; want stopped unknown outcome", result, err)
|
||||
}
|
||||
if len(database.execQueries) != 1 || database.execQueries[0] != "CREATE TABLE demo(id integer)" {
|
||||
t.Fatalf("unknown write was continued or replayed: %#v", database.execQueries)
|
||||
}
|
||||
}
|
||||
|
||||
func TestExecuteSQLFileBatchUnknownOutcomeDisablesFallback(t *testing.T) {
|
||||
database := &fakeSQLFileBatchDB{
|
||||
failBatch: true,
|
||||
batchError: db.MarkWriteOutcomeUnknown(errors.New("batch response lost")),
|
||||
}
|
||||
canFallback, outcomeUnknown, err := executeSQLFileBatchWithOutcome(
|
||||
context.Background(), database, database, "mysql", "INSERT INTO demo(id) VALUES (1)", false, nil,
|
||||
)
|
||||
if err == nil || canFallback || !outcomeUnknown {
|
||||
t.Fatalf("batch unknown result = canFallback=%t outcomeUnknown=%t err=%v; want no fallback and unknown", canFallback, outcomeUnknown, err)
|
||||
}
|
||||
}
|
||||
|
||||
func (f *fakeSQLFileBatchDB) GetDatabases() ([]string, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user