refactor: use nginx -s reload instead of systemd

- doc: add comment
This commit is contained in:
2026-08-17 10:10:14 +08:00
parent 79f18fcdea
commit f536987a7e
62 changed files with 2216 additions and 598 deletions
+20
View File
@@ -13,6 +13,9 @@ import (
"github.com/ncruces/go-sqlite3/driver"
)
// TestStoreMigratesVersionOneAndCommitsBackendContainerDeployment 验证从 v1 schema
// 迁移到最新版本,以及 backend 容器部署提交的完整链路:迁移前无部署记录、非容器类
// backend 事务不计入容器历史、未完成容器事务不计入、提交后单例记录与历史证据正确。
func TestStoreMigratesVersionOneAndCommitsBackendContainerDeployment(t *testing.T) {
t.Parallel()
ctx := context.Background()
@@ -105,6 +108,8 @@ func TestStoreMigratesVersionOneAndCommitsBackendContainerDeployment(t *testing.
}
}
// TestListRecentScansSQLiteRequestTextAsRawJSON 验证 ListRecent 能正确把 SQLite 中
// 存储的 request_json 文本还原为原始 JSON 字节,不丢失也不转义。
func TestListRecentScansSQLiteRequestTextAsRawJSON(t *testing.T) {
t.Parallel()
ctx := context.Background()
@@ -125,6 +130,8 @@ func TestListRecentScansSQLiteRequestTextAsRawJSON(t *testing.T) {
}
}
// TestBackendContainerDeploymentCommitRequiresDrainingTransaction 验证 backend 容器
// 部署提交要求事务必须处于 DRAINING 状态,否则返回 TransitionError 且不写入部署行。
func TestBackendContainerDeploymentCommitRequiresDrainingTransaction(t *testing.T) {
t.Parallel()
ctx := context.Background()
@@ -153,6 +160,10 @@ func TestBackendContainerDeploymentCommitRequiresDrainingTransaction(t *testing.
}
}
// TestStoreCreateIsIdempotentAndAllowsOnlyOneActiveTransaction 验证 CreateTransaction
// 的幂等性与单活动事务约束:同幂等键重试返回同一事务;活动事务未结束前新事务被
// ActiveTransactionError 拒绝;失败事务的幂等键被归档后可用新 ID 重试,且原事务的
// 幂等键被改写为带 :terminal: 前缀的归档形式。
func TestStoreCreateIsIdempotentAndAllowsOnlyOneActiveTransaction(t *testing.T) {
t.Parallel()
ctx := context.Background()
@@ -225,6 +236,8 @@ func TestStoreCreateIsIdempotentAndAllowsOnlyOneActiveTransaction(t *testing.T)
}
}
// TestStoreTransitionStepAndEventPersistence 验证状态、步骤与事件在关闭并重开数据库
// 后仍能正确恢复:事务状态与版本持久化、待定步骤可查询、步骤完成落库、事件有序递增。
func TestStoreTransitionStepAndEventPersistence(t *testing.T) {
t.Parallel()
ctx := context.Background()
@@ -299,6 +312,8 @@ func TestStoreTransitionStepAndEventPersistence(t *testing.T) {
}
}
// TestStoreRejectsInvalidTransitionAndConflictingStepIntent 验证非法状态转换返回
// TransitionError,以及同一步骤键以不同意图重复记录时返回 ErrStepConflict。
func TestStoreRejectsInvalidTransitionAndConflictingStepIntent(t *testing.T) {
t.Parallel()
ctx := context.Background()
@@ -331,6 +346,8 @@ func TestStoreRejectsInvalidTransitionAndConflictingStepIntent(t *testing.T) {
}
}
// TestStoreSerializesConcurrentCreates 验证并发创建事务时单活动事务约束生效:多个
// 并发创建请求中恰好一个成功,其余均以 ErrActiveExists 拒绝。
func TestStoreSerializesConcurrentCreates(t *testing.T) {
t.Parallel()
ctx := context.Background()
@@ -368,6 +385,9 @@ func TestStoreSerializesConcurrentCreates(t *testing.T) {
}
}
// openTestStore 在临时目录打开一个测试用 Store,并通过 t.Cleanup 确保测试结束时关闭。
//
// 参数 t 用于报告错误与注册清理函数。打开失败时以 t.Fatalf 终止测试。
func openTestStore(t *testing.T) *Store {
t.Helper()
store, err := OpenStore(context.Background(), filepath.Join(t.TempDir(), "transaction.db"))