feat(deploy): 在线更新 - 新增后台检查、强制备份迁移与失败自动回退

This commit is contained in:
ddCat committed 2026-08-30 22:15:17 +08:00
1 parent 4ba9694f45
commit db66ac1182
60 files changed
+4124 -93

No files matched your search

@@ -0,0 +1,27 @@
package hostupdate
import "testing"
func TestCompareVersions(t *testing.T) {
tests := []struct {
left, right string
want int
}{
{"v1.2.0-preview.2", "v1.2.0-preview.3", -1},
{"v1.2.0-preview.10", "v1.2.0-preview.3", 1},
{"v1.2.0-preview.3", "v1.2.0", -1},
{"v1.2.1", "v1.2.0", 1},
{"v1.2.0", "v1.2.0", 0},
}
for _, test := range tests {
got := CompareVersions(test.left, test.right)
if got < 0 {
got = -1
} else if got > 0 {
got = 1
}
if got != test.want {
t.Fatalf("CompareVersions(%q, %q)=%d, want %d", test.left, test.right, got, test.want)
}
}
}