增加需确认的全新部署流程

默认升级保留 Smail 运行数据;Linux 和 Windows 的全新部署均要求输入确认词,先备份后仅清理 Smail 专属目录,并补充部署策略回归用例。
This commit is contained in:
xuans committed 2026-10-01 11:48:03 +08:00
1 parent e5d52ed681
commit ca28fa982e
4 files changed
+168 -39

No files matched your search

@@ -96,6 +96,29 @@ func TestInstallerManagesProtectedEnvironmentFile(t *testing.T) {
}
}
func TestInstallerRequiresExplicitFreshReset(t *testing.T) {
root := filepath.Clean(filepath.Join("..", "..", ".."))
installer, err := os.ReadFile(filepath.Join(root, "deploy", "install-systemd.sh"))
if err != nil {
t.Fatal(err)
}
content := string(installer)
for _, required := range []string{
"--fresh",
"确认全新部署 Smail",
"cp -a -- \"$runtime_dir/.\" \"$backup_dir/runtime/\"",
"find \"$runtime_dir\" -mindepth 1 -maxdepth 1 -exec rm -rf -- {} +",
"systemctl disable smail smail-admin",
} {
if !strings.Contains(content, required) {
t.Fatalf("installer is missing explicit fresh-reset behavior %q", required)
}
}
if strings.Contains(content, "全新部署已停止:$target 非空") {
t.Fatal("installer must not reject existing data without an explicit fresh-reset request")
}
}
func TestSmailServiceRetainsPluginIsolationCapabilities(t *testing.T) {
root := filepath.Clean(filepath.Join("..", "..", ".."))
unit, err := os.ReadFile(filepath.Join(root, "deploy", "systemd", "smail.service"))